00001 // -*- C++ -*- 00002 // 00003 // $Id: FlowSpec_Entry.inl 81401 2008-04-23 18:12:56Z elliott_c $ 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, bool cleanup) 00095 { 00096 if (this->clean_up_address_) 00097 delete this->address_; 00098 00099 this->address_ = addr; 00100 this->clean_up_address_ = cleanup; 00101 } 00102 00103 ACE_INLINE 00104 ACE_Addr * 00105 TAO_FlowSpec_Entry::control_address (void) 00106 { 00107 return this->control_address_; 00108 } 00109 00110 ACE_INLINE 00111 void 00112 TAO_FlowSpec_Entry::control_address (ACE_Addr *addr) 00113 { 00114 this->control_address_ = addr; 00115 } 00116 00117 ACE_INLINE 00118 const char * 00119 TAO_FlowSpec_Entry::address_str (void) const 00120 { 00121 return this->address_str_.c_str(); 00122 } 00123 00124 ACE_INLINE 00125 const char* 00126 TAO_FlowSpec_Entry::format (void) const 00127 { 00128 return this->format_.c_str(); 00129 } 00130 00131 ACE_INLINE 00132 const char * 00133 TAO_FlowSpec_Entry::flowname (void) const 00134 { 00135 return this->flowname_.c_str(); 00136 } 00137 00138 00139 ACE_INLINE 00140 int 00141 TAO_FlowSpec_Entry::set_peer_addr (ACE_Addr *peer_addr) 00142 { 00143 if (this->delete_peer_addr_) 00144 delete this->peer_addr_; 00145 00146 this->delete_peer_addr_ = false; 00147 this->peer_addr_ = peer_addr; 00148 00149 if (this->handler_ != 0) 00150 this->handler_->set_remote_address (peer_addr); 00151 return 0; 00152 } 00153 00154 ACE_INLINE 00155 ACE_Addr * 00156 TAO_FlowSpec_Entry::get_peer_addr (void) 00157 { 00158 return this->peer_addr_; 00159 } 00160 00161 ACE_INLINE 00162 int 00163 TAO_FlowSpec_Entry::set_local_addr (ACE_Addr *local_addr) 00164 { 00165 this->local_addr_ = local_addr; 00166 return 0; 00167 } 00168 00169 ACE_INLINE 00170 int 00171 TAO_FlowSpec_Entry::set_local_control_addr (ACE_Addr *local_addr) 00172 { 00173 this->local_control_addr_ = local_addr; 00174 return 0; 00175 } 00176 00177 ACE_INLINE 00178 ACE_Addr* 00179 TAO_FlowSpec_Entry::get_local_addr (void) 00180 { 00181 return this->local_addr_; 00182 } 00183 00184 ACE_INLINE 00185 ACE_Addr* 00186 TAO_FlowSpec_Entry::get_local_control_addr (void) 00187 { 00188 return this->local_control_addr_; 00189 } 00190 00191 ACE_INLINE 00192 int 00193 TAO_FlowSpec_Entry::set_local_sec_addr (char** local_sec_addr, 00194 int size) 00195 { 00196 this->local_sec_addr_ = local_sec_addr; 00197 this->num_local_sec_addrs_ = size; 00198 return 0; 00199 } 00200 00201 ACE_INLINE 00202 char** 00203 TAO_FlowSpec_Entry::get_local_sec_addr (void) 00204 { 00205 return this->local_sec_addr_; 00206 } 00207 00208 ACE_INLINE 00209 int 00210 TAO_FlowSpec_Entry::num_local_sec_addrs (void) 00211 { 00212 return this->num_local_sec_addrs_; 00213 } 00214 00215 ACE_INLINE 00216 int 00217 TAO_FlowSpec_Entry::set_peer_sec_addr (char** peer_sec_addr, 00218 int size) 00219 { 00220 this->peer_sec_addr_ = peer_sec_addr; 00221 this->num_peer_sec_addrs_ = size; 00222 return 0; 00223 } 00224 00225 ACE_INLINE 00226 char** 00227 TAO_FlowSpec_Entry::get_peer_sec_addr (void) 00228 { 00229 return this->peer_sec_addr_; 00230 } 00231 00232 ACE_INLINE 00233 int 00234 TAO_FlowSpec_Entry::num_peer_sec_addrs (void) 00235 { 00236 return this->num_peer_sec_addrs_; 00237 } 00238 00239 ACE_INLINE 00240 TAO_AV_Transport* 00241 TAO_FlowSpec_Entry::transport (void) 00242 { 00243 return this->transport_; 00244 } 00245 00246 ACE_INLINE 00247 void 00248 TAO_FlowSpec_Entry::transport (TAO_AV_Transport *transport) 00249 { 00250 this->transport_ = transport; 00251 } 00252 00253 ACE_INLINE 00254 TAO_AV_Transport* 00255 TAO_FlowSpec_Entry::control_transport (void) 00256 { 00257 return this->control_transport_; 00258 } 00259 00260 ACE_INLINE 00261 void 00262 TAO_FlowSpec_Entry::control_transport (TAO_AV_Transport *control_transport) 00263 { 00264 this->control_transport_ = control_transport; 00265 } 00266 00267 ACE_INLINE 00268 TAO_AV_Flow_Handler * 00269 TAO_FlowSpec_Entry::handler (void) 00270 { 00271 return this->handler_; 00272 } 00273 00274 ACE_INLINE 00275 TAO_AV_Flow_Handler * 00276 TAO_FlowSpec_Entry::control_handler (void) 00277 { 00278 return this->control_handler_; 00279 } 00280 00281 ACE_INLINE 00282 void 00283 TAO_FlowSpec_Entry::handler (TAO_AV_Flow_Handler *handler) 00284 { 00285 this->handler_ = handler; 00286 00287 // // Now remove the handler from the reactor if the handler is for a producer. 00288 // switch (this->role ()) 00289 // { 00290 // case TAO_AV_PRODUCER: 00291 // { 00292 // ACE_Event_Handler *event_handler = handler->event_handler (); 00293 // int result = event_handler->reactor ()->remove_handler (event_handler, 00294 // ACE_Event_Handler::READ_MASK); 00295 // if (result < 0) 00296 // ACE_ERROR ((LM_ERROR,"TAO_FlowSpec_Entry::handler\n")); 00297 // break; 00298 // } 00299 // } 00300 } 00301 00302 ACE_INLINE 00303 void 00304 TAO_FlowSpec_Entry::control_handler (TAO_AV_Flow_Handler *handler) 00305 { 00306 this->control_handler_ = handler; 00307 } 00308 00309 ACE_INLINE 00310 TAO_AV_Protocol_Object* 00311 TAO_FlowSpec_Entry::protocol_object (void) 00312 { 00313 return this->protocol_object_; 00314 } 00315 00316 ACE_INLINE 00317 void 00318 TAO_FlowSpec_Entry::protocol_object (TAO_AV_Protocol_Object *object) 00319 { 00320 this->protocol_object_ = object; 00321 } 00322 00323 ACE_INLINE 00324 TAO_AV_Protocol_Object* 00325 TAO_FlowSpec_Entry::control_protocol_object (void) 00326 { 00327 return this->control_protocol_object_; 00328 } 00329 00330 ACE_INLINE 00331 void 00332 TAO_FlowSpec_Entry::control_protocol_object (TAO_AV_Protocol_Object *object) 00333 { 00334 this->control_protocol_object_ = object; 00335 } 00336 00337 ACE_INLINE 00338 int 00339 TAO_FlowSpec_Entry::is_multicast (void) 00340 { 00341 return this->is_multicast_; 00342 } 00343 00344 ACE_INLINE 00345 void 00346 TAO_FlowSpec_Entry::role (TAO_FlowSpec_Entry::Role role) 00347 { 00348 this->role_ = role; 00349 } 00350 00351 TAO_END_VERSIONED_NAMESPACE_DECL