00001 // -*- C++ -*- 00002 // 00003 // FlowSpec_Entry.i,v 5.11 2005/11/10 06:47:22 ossama Exp 00004 00005 #include "ace/OS_NS_strings.h" 00006 00007 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00008 00009 ACE_INLINE 00010 int 00011 TAO_FlowSpec_Entry::set_direction (const char *direction) 00012 { 00013 this->direction_str_ = direction; 00014 if (direction == 0) 00015 { 00016 this->direction_ = TAO_AV_INVALID; 00017 return -1; 00018 } 00019 if (ACE_OS::strcasecmp (direction,"in") == 0) 00020 this->direction_ = TAO_AV_DIR_IN; 00021 else if (ACE_OS::strcasecmp (direction,"out") == 0) 00022 this->direction_ = TAO_AV_DIR_OUT; 00023 return 0; 00024 } 00025 00026 ACE_INLINE 00027 int 00028 TAO_FlowSpec_Entry::parse_flow_protocol_string (const char *flow_string) 00029 { 00030 if (flow_string == 0) 00031 return 0; 00032 00033 if (ACE_OS::strcmp (flow_string,"") == 0) 00034 return 0; 00035 00036 this->use_flow_protocol_ = 1; 00037 // do some flow protocol processing. 00038 this->flow_protocol_ = flow_string; 00039 00040 return 0; 00041 } 00042 00043 ACE_INLINE 00044 int 00045 TAO_FlowSpec_Entry::direction (void) 00046 { 00047 return this->direction_; 00048 } 00049 00050 ACE_INLINE 00051 const char * 00052 TAO_FlowSpec_Entry::direction_str (void) const 00053 { 00054 return this->direction_str_.c_str(); 00055 } 00056 00057 ACE_INLINE 00058 const char * 00059 TAO_FlowSpec_Entry::flow_protocol_str (void) const 00060 { 00061 return this->flow_protocol_.c_str(); 00062 } 00063 00064 ACE_INLINE 00065 void 00066 TAO_FlowSpec_Entry::flow_protocol_str (const char *str) 00067 { 00068 this->flow_protocol_ = CORBA::string_dup (str); 00069 } 00070 00071 ACE_INLINE 00072 TAO_AV_Core::Protocol 00073 TAO_FlowSpec_Entry::carrier_protocol (void) 00074 { 00075 return this->protocol_; 00076 } 00077 00078 ACE_INLINE 00079 const char * 00080 TAO_FlowSpec_Entry::carrier_protocol_str (void) const 00081 { 00082 return this->carrier_protocol_.c_str(); 00083 } 00084 00085 ACE_INLINE 00086 ACE_Addr * 00087 TAO_FlowSpec_Entry::address (void) 00088 { 00089 return this->address_; 00090 } 00091 00092 ACE_INLINE 00093 void 00094 TAO_FlowSpec_Entry::address (ACE_Addr *addr) 00095 { 00096 this->address_ = addr; 00097 } 00098 00099 ACE_INLINE 00100 ACE_Addr * 00101 TAO_FlowSpec_Entry::control_address (void) 00102 { 00103 return this->control_address_; 00104 } 00105 00106 ACE_INLINE 00107 void 00108 TAO_FlowSpec_Entry::control_address (ACE_Addr *addr) 00109 { 00110 this->control_address_ = addr; 00111 } 00112 00113 ACE_INLINE 00114 const char * 00115 TAO_FlowSpec_Entry::address_str (void) const 00116 { 00117 return this->address_str_.c_str(); 00118 } 00119 00120 ACE_INLINE 00121 const char* 00122 TAO_FlowSpec_Entry::format (void) const 00123 { 00124 return this->format_.c_str(); 00125 } 00126 00127 ACE_INLINE 00128 const char * 00129 TAO_FlowSpec_Entry::flowname (void) const 00130 { 00131 return this->flowname_.c_str(); 00132 } 00133 00134 00135 ACE_INLINE 00136 int 00137 TAO_FlowSpec_Entry::set_peer_addr (ACE_Addr *peer_addr) 00138 { 00139 if (this->delete_peer_addr_) 00140 delete this->peer_addr_; 00141 00142 this->delete_peer_addr_ = false; 00143 this->peer_addr_ = peer_addr; 00144 00145 if (this->handler_ != 0) 00146 this->handler_->set_remote_address (peer_addr); 00147 return 0; 00148 } 00149 00150 ACE_INLINE 00151 ACE_Addr * 00152 TAO_FlowSpec_Entry::get_peer_addr (void) 00153 { 00154 return this->peer_addr_; 00155 } 00156 00157 ACE_INLINE 00158 int 00159 TAO_FlowSpec_Entry::set_local_addr (ACE_Addr *local_addr) 00160 { 00161 this->local_addr_ = local_addr; 00162 return 0; 00163 } 00164 00165 ACE_INLINE 00166 int 00167 TAO_FlowSpec_Entry::set_local_control_addr (ACE_Addr *local_addr) 00168 { 00169 this->local_control_addr_ = local_addr; 00170 return 0; 00171 } 00172 00173 ACE_INLINE 00174 ACE_Addr* 00175 TAO_FlowSpec_Entry::get_local_addr (void) 00176 { 00177 return this->local_addr_; 00178 } 00179 00180 ACE_INLINE 00181 ACE_Addr* 00182 TAO_FlowSpec_Entry::get_local_control_addr (void) 00183 { 00184 return this->local_control_addr_; 00185 } 00186 00187 ACE_INLINE 00188 int 00189 TAO_FlowSpec_Entry::set_local_sec_addr (char** local_sec_addr, 00190 int size) 00191 { 00192 this->local_sec_addr_ = local_sec_addr; 00193 this->num_local_sec_addrs_ = size; 00194 return 0; 00195 } 00196 00197 ACE_INLINE 00198 char** 00199 TAO_FlowSpec_Entry::get_local_sec_addr (void) 00200 { 00201 return this->local_sec_addr_; 00202 } 00203 00204 ACE_INLINE 00205 int 00206 TAO_FlowSpec_Entry::num_local_sec_addrs (void) 00207 { 00208 return this->num_local_sec_addrs_; 00209 } 00210 00211 ACE_INLINE 00212 int 00213 TAO_FlowSpec_Entry::set_peer_sec_addr (char** peer_sec_addr, 00214 int size) 00215 { 00216 this->peer_sec_addr_ = peer_sec_addr; 00217 this->num_peer_sec_addrs_ = size; 00218 return 0; 00219 } 00220 00221 ACE_INLINE 00222 char** 00223 TAO_FlowSpec_Entry::get_peer_sec_addr (void) 00224 { 00225 return this->peer_sec_addr_; 00226 } 00227 00228 ACE_INLINE 00229 int 00230 TAO_FlowSpec_Entry::num_peer_sec_addrs (void) 00231 { 00232 return this->num_peer_sec_addrs_; 00233 } 00234 00235 ACE_INLINE 00236 TAO_AV_Transport* 00237 TAO_FlowSpec_Entry::transport (void) 00238 { 00239 return this->transport_; 00240 } 00241 00242 ACE_INLINE 00243 void 00244 TAO_FlowSpec_Entry::transport (TAO_AV_Transport *transport) 00245 { 00246 this->transport_ = transport; 00247 } 00248 00249 ACE_INLINE 00250 TAO_AV_Transport* 00251 TAO_FlowSpec_Entry::control_transport (void) 00252 { 00253 return this->control_transport_; 00254 } 00255 00256 ACE_INLINE 00257 void 00258 TAO_FlowSpec_Entry::control_transport (TAO_AV_Transport *control_transport) 00259 { 00260 this->control_transport_ = control_transport; 00261 } 00262 00263 ACE_INLINE 00264 TAO_AV_Flow_Handler * 00265 TAO_FlowSpec_Entry::handler (void) 00266 { 00267 return this->handler_; 00268 } 00269 00270 ACE_INLINE 00271 TAO_AV_Flow_Handler * 00272 TAO_FlowSpec_Entry::control_handler (void) 00273 { 00274 return this->control_handler_; 00275 } 00276 00277 ACE_INLINE 00278 void 00279 TAO_FlowSpec_Entry::handler (TAO_AV_Flow_Handler *handler) 00280 { 00281 this->handler_ = handler; 00282 00283 // // Now remove the handler from the reactor if the handler is for a producer. 00284 // switch (this->role ()) 00285 // { 00286 // case TAO_AV_PRODUCER: 00287 // { 00288 // ACE_Event_Handler *event_handler = handler->event_handler (); 00289 // int result = event_handler->reactor ()->remove_handler (event_handler, 00290 // ACE_Event_Handler::READ_MASK); 00291 // if (result < 0) 00292 // ACE_ERROR ((LM_ERROR,"TAO_FlowSpec_Entry::handler\n")); 00293 // break; 00294 // } 00295 // } 00296 } 00297 00298 ACE_INLINE 00299 void 00300 TAO_FlowSpec_Entry::control_handler (TAO_AV_Flow_Handler *handler) 00301 { 00302 this->control_handler_ = handler; 00303 } 00304 00305 ACE_INLINE 00306 TAO_AV_Protocol_Object* 00307 TAO_FlowSpec_Entry::protocol_object (void) 00308 { 00309 return this->protocol_object_; 00310 } 00311 00312 ACE_INLINE 00313 void 00314 TAO_FlowSpec_Entry::protocol_object (TAO_AV_Protocol_Object *object) 00315 { 00316 this->protocol_object_ = object; 00317 } 00318 00319 ACE_INLINE 00320 TAO_AV_Protocol_Object* 00321 TAO_FlowSpec_Entry::control_protocol_object (void) 00322 { 00323 return this->control_protocol_object_; 00324 } 00325 00326 ACE_INLINE 00327 void 00328 TAO_FlowSpec_Entry::control_protocol_object (TAO_AV_Protocol_Object *object) 00329 { 00330 this->control_protocol_object_ = object; 00331 } 00332 00333 ACE_INLINE 00334 int 00335 TAO_FlowSpec_Entry::is_multicast (void) 00336 { 00337 return this->is_multicast_; 00338 } 00339 00340 ACE_INLINE 00341 void 00342 TAO_FlowSpec_Entry::role (TAO_FlowSpec_Entry::Role role) 00343 { 00344 this->role_ = role; 00345 } 00346 00347 TAO_END_VERSIONED_NAMESPACE_DECL