TAO_SHMIOP_Acceptor Class Reference

The SHMIOP-specific bridge class for the concrete acceptor. More...

#include <SHMIOP_Acceptor.h>

Inheritance diagram for TAO_SHMIOP_Acceptor:

Inheritance graph
[legend]
Collaboration diagram for TAO_SHMIOP_Acceptor:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_Strategy_Acceptor<
TAO_SHMIOP_Connection_Handler,
ACE_MEM_ACCEPTOR
TAO_SHMIOP_BASE_ACCEPTOR
typedef TAO_Creation_Strategy<
TAO_SHMIOP_Connection_Handler
TAO_SHMIOP_CREATION_STRATEGY
typedef TAO_Concurrency_Strategy<
TAO_SHMIOP_Connection_Handler
TAO_SHMIOP_CONCURRENCY_STRATEGY
typedef TAO_Accept_Strategy<
TAO_SHMIOP_Connection_Handler,
ACE_MEM_ACCEPTOR
TAO_SHMIOP_ACCEPT_STRATEGY

Public Member Functions

 TAO_SHMIOP_Acceptor (CORBA::Boolean flag=false)
 Constructor.

 ~TAO_SHMIOP_Acceptor (void)
 Destructor.

int set_mmap_options (const ACE_TCHAR *prefix, off_t size)
The TAO_Acceptor Methods
Please check the documentation in Transport_Acceptor.h for details.

virtual int open (TAO_ORB_Core *orb_core, ACE_Reactor *reactor, int version_major, int version_minor, const char *port, const char *options=0)
virtual int open_default (TAO_ORB_Core *orb_core, ACE_Reactor *reactor, int version_major, int version_minor, const char *options=0)
virtual int close (void)
virtual int create_profile (const TAO::ObjectKey &object_key, TAO_MProfile &mprofile, CORBA::Short priority)
virtual int is_collocated (const TAO_Endpoint *endpoint)
virtual CORBA::ULong endpoint_count (void)
virtual int object_key (IOP::TaggedProfile &profile, TAO::ObjectKey &key)

Protected Attributes

ACE_CString host_
ACE_MEM_Addr address_
 A local endpoint.

TAO_GIOP_Message_Version version_
 The GIOP version for this endpoint.

TAO_ORB_Coreorb_core_
 ORB Core.


Private Member Functions

int open_i (TAO_ORB_Core *orb_core, ACE_Reactor *reactor)
 Implement the common part of the open*() methods.

virtual int parse_options (const char *options)
 Parse protocol specific options.

int create_new_profile (const TAO::ObjectKey &object_key, TAO_MProfile &mprofile, CORBA::Short priority)
 Create a SHMIOP profile representing this acceptor.

int create_shared_profile (const TAO::ObjectKey &object_key, TAO_MProfile &mprofile, CORBA::Short priority)
 Add the endpoints on this acceptor to a shared profile.


Private Attributes

TAO_SHMIOP_BASE_ACCEPTOR base_acceptor_
 The concrete acceptor, as a pointer to it's base class.

TAO_SHMIOP_CREATION_STRATEGYcreation_strategy_
 Acceptor strategies.

TAO_SHMIOP_CONCURRENCY_STRATEGYconcurrency_strategy_
TAO_SHMIOP_ACCEPT_STRATEGYaccept_strategy_
const ACE_TCHARmmap_file_prefix_
 Determine the prefix (include path name) of the mmap file.

off_t mmap_size_
CORBA::Boolean lite_flag_
 Should we use GIOP lite??


Detailed Description

The SHMIOP-specific bridge class for the concrete acceptor.

Definition at line 44 of file SHMIOP_Acceptor.h.


Member Typedef Documentation

typedef TAO_Accept_Strategy<TAO_SHMIOP_Connection_Handler, ACE_MEM_ACCEPTOR> TAO_SHMIOP_Acceptor::TAO_SHMIOP_ACCEPT_STRATEGY
 

Definition at line 56 of file SHMIOP_Acceptor.h.

Referenced by open_i().

typedef ACE_Strategy_Acceptor<TAO_SHMIOP_Connection_Handler, ACE_MEM_ACCEPTOR> TAO_SHMIOP_Acceptor::TAO_SHMIOP_BASE_ACCEPTOR
 

Definition at line 53 of file SHMIOP_Acceptor.h.

typedef TAO_Concurrency_Strategy<TAO_SHMIOP_Connection_Handler> TAO_SHMIOP_Acceptor::TAO_SHMIOP_CONCURRENCY_STRATEGY
 

Definition at line 55 of file SHMIOP_Acceptor.h.

Referenced by open_i().

typedef TAO_Creation_Strategy<TAO_SHMIOP_Connection_Handler> TAO_SHMIOP_Acceptor::TAO_SHMIOP_CREATION_STRATEGY
 

Definition at line 54 of file SHMIOP_Acceptor.h.

Referenced by open_i().


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_SHMIOP_Acceptor::TAO_SHMIOP_Acceptor CORBA::Boolean  flag = false  ) 
 

Constructor.

Definition at line 24 of file SHMIOP_Acceptor.cpp.

References TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR, and TAO_TAG_SHMEM_PROFILE.

00025   : TAO_Acceptor (TAO_TAG_SHMEM_PROFILE),
00026     version_ (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR),
00027     orb_core_ (0),
00028     base_acceptor_ (),
00029     creation_strategy_ (0),
00030     concurrency_strategy_ (0),
00031     accept_strategy_ (0),
00032     mmap_file_prefix_ (0),
00033     mmap_size_ (1024 * 1024),
00034     lite_flag_ (flag)
00035 {
00036 }

TAO_SHMIOP_Acceptor::~TAO_SHMIOP_Acceptor void   ) 
 

Destructor.

Definition at line 38 of file SHMIOP_Acceptor.cpp.

References close().

00039 {
00040   // Make sure we are closed before we start destroying the
00041   // strategies.
00042   this->close ();
00043 
00044   delete this->creation_strategy_;
00045   delete this->concurrency_strategy_;
00046   delete this->accept_strategy_;
00047 }


Member Function Documentation

int TAO_SHMIOP_Acceptor::close void   )  [virtual]
 

Implements TAO_Acceptor.

Definition at line 185 of file SHMIOP_Acceptor.cpp.

References ACE_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 >::close().

Referenced by ~TAO_SHMIOP_Acceptor().

00186 {
00187   return this->base_acceptor_.close ();
00188 }

int TAO_SHMIOP_Acceptor::create_new_profile const TAO::ObjectKey object_key,
TAO_MProfile mprofile,
CORBA::Short  priority
[private]
 

Create a SHMIOP profile representing this acceptor.

Definition at line 72 of file SHMIOP_Acceptor.cpp.

References TAO_Profile::_decr_refcnt(), ACE_NEW_RETURN, TAO_ORB_Core::codeset_manager(), TAO_SHMIOP_Profile::endpoint(), ACE_MEM_Addr::get_port_number(), ACE_MEM_Addr::get_remote_addr(), TAO_MProfile::give_profile(), TAO_MProfile::grow(), TAO_GIOP_Message_Version::major, TAO_GIOP_Message_Version::minor, TAO_ORB_Core::orb_params(), TAO_Endpoint::priority(), TAO_MProfile::profile_count(), TAO_Codeset_Manager::set_codeset(), TAO_Tagged_Components::set_orb_type(), TAO_MProfile::size(), TAO_ORB_Parameters::std_profile_components(), TAO_Profile::tagged_components(), and TAO_ORB_TYPE.

Referenced by create_profile(), and create_shared_profile().

00075 {
00076   // @@ we only make one for now
00077   int count = mprofile.profile_count ();
00078   if ((mprofile.size () - count) < 1
00079       && mprofile.grow (count + 1) == -1)
00080     return -1;
00081 
00082   TAO_SHMIOP_Profile *pfile = 0;
00083   ACE_NEW_RETURN (pfile,
00084                   TAO_SHMIOP_Profile (this->host_.c_str (),
00085                                       this->address_.get_port_number (),
00086                                       object_key,
00087                                       this->address_.get_remote_addr (),
00088                                       this->version_,
00089                                       this->orb_core_),
00090                   -1);
00091   pfile->endpoint ()->priority (priority);
00092 
00093   if (mprofile.give_profile (pfile) == -1)
00094     {
00095       pfile->_decr_refcnt ();
00096       pfile = 0;
00097       return -1;
00098     }
00099 
00100   // Do not add any tagged components to the profile if configured
00101   // by the user not to do so, or if an SHMIOP 1.0 endpoint is being
00102   // created (IIOP 1.0 did not support tagged components, so we follow
00103   // the same convention for SHMIOP).
00104   if (this->orb_core_->orb_params ()->std_profile_components () == 0
00105       || (this->version_.major == 1 && this->version_.minor == 0))
00106     return 0;
00107 
00108   pfile->tagged_components ().set_orb_type (TAO_ORB_TYPE);
00109   TAO_Codeset_Manager *csm = this->orb_core_->codeset_manager();
00110   if (csm)
00111     csm->set_codeset(pfile->tagged_components());
00112   return 0;
00113 }

int TAO_SHMIOP_Acceptor::create_profile const TAO::ObjectKey object_key,
TAO_MProfile mprofile,
CORBA::Short  priority
[virtual]
 

Implements TAO_Acceptor.

Definition at line 55 of file SHMIOP_Acceptor.cpp.

References create_new_profile(), create_shared_profile(), and TAO_INVALID_PRIORITY.

00058 {
00059   // Check if multiple endpoints should be put in one profile or
00060   // if they should be spread across multiple profiles.
00061   if (priority == TAO_INVALID_PRIORITY)
00062     return this->create_new_profile (object_key,
00063                                      mprofile,
00064                                      priority);
00065   else
00066     return this->create_shared_profile (object_key,
00067                                         mprofile,
00068                                         priority);
00069 }

int TAO_SHMIOP_Acceptor::create_shared_profile const TAO::ObjectKey object_key,
TAO_MProfile mprofile,
CORBA::Short  priority
[private]
 

Add the endpoints on this acceptor to a shared profile.

Definition at line 116 of file SHMIOP_Acceptor.cpp.

References ACE_NEW_RETURN, TAO_SHMIOP_Profile::add_endpoint(), create_new_profile(), ACE_MEM_Addr::get_port_number(), TAO_MProfile::get_profile(), ACE_MEM_Addr::get_remote_addr(), TAO_Endpoint::priority(), TAO_MProfile::profile_count(), TAO_Profile::tag(), TAO_PHandle, and TAO_TAG_SHMEM_PROFILE.

Referenced by create_profile().

00119 {
00120   TAO_Profile *pfile = 0;
00121   TAO_SHMIOP_Profile *shmiop_profile = 0;
00122 
00123   // First see if <mprofile> already contains a SHMIOP profile.
00124   for (TAO_PHandle i = 0; i != mprofile.profile_count (); ++i)
00125     {
00126       pfile = mprofile.get_profile (i);
00127       if (pfile->tag () == TAO_TAG_SHMEM_PROFILE)
00128       {
00129         shmiop_profile = dynamic_cast <TAO_SHMIOP_Profile *>(pfile);
00130         break;
00131       }
00132     }
00133 
00134   if (shmiop_profile == 0)
00135     {
00136       // If <mprofile> doesn't contain SHMIOP_Profile, we need to create
00137       // one.
00138       return create_new_profile (object_key,
00139                                  mprofile,
00140                                  priority);
00141     }
00142   else
00143     {
00144       // A SHMIOP_Profile already exists - just add our endpoint to it.
00145 
00146       TAO_SHMIOP_Endpoint *endpoint = 0;
00147       ACE_NEW_RETURN (endpoint,
00148                       TAO_SHMIOP_Endpoint (this->host_.c_str (),
00149                                            this->address_.get_port_number (),
00150                                            this->address_.get_remote_addr ()),
00151                       -1);
00152       endpoint->priority (priority);
00153       shmiop_profile->add_endpoint (endpoint);
00154 
00155       return 0;
00156     }
00157 }

CORBA::ULong TAO_SHMIOP_Acceptor::endpoint_count void   )  [virtual]
 

Implements TAO_Acceptor.

Definition at line 411 of file SHMIOP_Acceptor.cpp.

00412 {
00413   // @@ for now just assume one!
00414   // we should take a look at the local address, if it is zero then
00415   // get the list of available IP interfaces and return this number.
00416   return 1;
00417 }

int TAO_SHMIOP_Acceptor::is_collocated const TAO_Endpoint endpoint  )  [virtual]
 

Implements TAO_Acceptor.

Definition at line 160 of file SHMIOP_Acceptor.cpp.

References TAO_SHMIOP_Endpoint::object_addr(), and ACE_MEM_Addr::same_host().

00161 {
00162   const TAO_SHMIOP_Endpoint *endp =
00163     dynamic_cast <const TAO_SHMIOP_Endpoint *> (endpoint);
00164 
00165   // Make sure the dynamically cast pointer is valid.
00166   if (endp == 0)
00167     return 0;
00168 
00169       // @@ TODO The following code looks funky, why only the host
00170       //    name is compared?  What if there are multiple SHMIOP
00171       //    servers in the same address?  Why do SHMIOP_Endpoints keep
00172       //    a INET_Addr but not a MEM_Addr?  And why is there no lazy
00173       //    evaluation of IP-addresses for SHMIOP endpoints?  Is it
00174       //    because it is always 'localhost'?  We need answers to
00175       //    these questions to solve:
00176       //
00177       // http://deuce.doc.wustl.edu/bugzilla/show_bug.cgi?id=1220
00178       //
00179   // The following code is suspec
00180   // compare the port and sin_addr (numeric host address)
00181   return this->address_.same_host (endp->object_addr ());
00182 }

int TAO_SHMIOP_Acceptor::object_key IOP::TaggedProfile profile,
TAO::ObjectKey key
[virtual]
 

Implements TAO_Acceptor.

Definition at line 355 of file SHMIOP_Acceptor.cpp.

References ACE_DEBUG, ACE_ERROR, ACE_TEXT, TAO::unbounded_value_sequence< T >::get_buffer(), TAO::unbounded_value_sequence< T >::length(), LM_DEBUG, LM_ERROR, IOP::TaggedProfile::profile_data, ACE_InputCDR::read_octet(), ACE_InputCDR::read_string(), ACE_InputCDR::read_ushort(), and TAO_debug_level.

00357 {
00358   // Create the decoding stream from the encapsulation in the buffer,
00359 #if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
00360   TAO_InputCDR cdr (profile.profile_data.mb ());
00361 #else
00362   TAO_InputCDR cdr (reinterpret_cast<char*>(profile.profile_data.get_buffer ()),
00363                     profile.profile_data.length ());
00364 #endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */
00365 
00366   CORBA::Octet major = 0;
00367   CORBA::Octet minor = 0;
00368 
00369   // Read the version. We just read it here. We don't*do any*
00370   // processing.
00371   if (!(cdr.read_octet (major)
00372         && cdr.read_octet (minor)))
00373   {
00374     if (TAO_debug_level > 0)
00375       {
00376         ACE_DEBUG ((LM_DEBUG,
00377                     ACE_TEXT ("TAO (%P|%t) - SHMIOP_Profile::decode, v%d.%d\n"),
00378                     major,
00379                     minor));
00380       }
00381     return -1;
00382   }
00383 
00384   CORBA::String_var host;
00385   CORBA::UShort port = 0;
00386 
00387   // Get host and port. No processing here too..
00388   if (cdr.read_string (host.out ()) == 0
00389       || cdr.read_ushort (port) == 0)
00390     {
00391       if (TAO_debug_level > 0)
00392         {
00393           ACE_ERROR ((LM_ERROR,
00394                       ACE_TEXT ("TAO (%P|%t) - SHMIOP_Acceptor::object_key, ")
00395                       ACE_TEXT ("error while decoding host/port\n")));
00396         }
00397       return -1;
00398     }
00399 
00400   // ... and object key.
00401   if ((cdr >> object_key) == 0)
00402     return -1;
00403 
00404   // We are NOT bothered about the rest.
00405 
00406   return 1;
00407 }

int TAO_SHMIOP_Acceptor::open TAO_ORB_Core orb_core,
ACE_Reactor reactor,
int  version_major,
int  version_minor,
const char *  port,
const char *  options = 0
[virtual]
 

Implements TAO_Acceptor.

Definition at line 191 of file SHMIOP_Acceptor.cpp.

References ACE_TEXT_CHAR_TO_TCHAR, open_i(), parse_options(), ACE_MEM_Addr::set(), and TAO_GIOP_Message_Version::set_version().

00197 {
00198   if (major >=0 && minor >= 0)
00199     this->version_.set_version (static_cast <CORBA::Octet>(major),
00200                                 static_cast <CORBA::Octet>(minor));
00201   // Parse options
00202   if (this->parse_options (options) == -1)
00203     return -1;
00204 
00205   if (isdigit (*port) == 0)
00206     return -1;                  // Port number must consist of digits
00207 
00208   if (port)
00209     this->address_.set (ACE_TEXT_CHAR_TO_TCHAR(port));
00210 
00211   return this->open_i (orb_core,
00212                        reactor);
00213 }

int TAO_SHMIOP_Acceptor::open_default TAO_ORB_Core orb_core,
ACE_Reactor reactor,
int  version_major,
int  version_minor,
const char *  options = 0
[virtual]
 

Implements TAO_Acceptor.

Definition at line 216 of file SHMIOP_Acceptor.cpp.

References ACE_MEM_Addr::get_host_name(), open_i(), parse_options(), and TAO_GIOP_Message_Version::set_version().

00221 {
00222   if (major >=0 && minor >= 0)
00223     this->version_.set_version (static_cast <CORBA::Octet>(major),
00224                                 static_cast <CORBA::Octet>(minor));
00225 
00226   // Parse options
00227   if (this->parse_options (options) == -1)
00228     return -1;
00229 
00230   // @@ Until we can support multihomed machines correctly we must
00231   //    pick the "default interface" and only listen on that IP
00232   //    address.
00233   this->host_ = this->address_.get_host_name ();
00234 
00235   return this->open_i (orb_core,
00236                        reactor);
00237 }

int TAO_SHMIOP_Acceptor::open_i TAO_ORB_Core orb_core,
ACE_Reactor reactor
[private]
 

Implement the common part of the open*() methods.

Definition at line 250 of file SHMIOP_Acceptor.cpp.

References ACE_Strategy_Acceptor< SVC_HANDLER, >::acceptor(), ACE_CLOEXEC, ACE_DEBUG, ACE_ERROR, ACE_NEW_RETURN, ACE_TCHAR, ACE_TEXT, ACE_TEXT_ALWAYS_CHAR, ACE_TEXT_CHAR_TO_TCHAR, ACE_INET_Addr::get_host_addr(), ACE_MEM_Addr::get_host_name(), ACE_MEM_Addr::get_port_number(), ACE_MEM_Addr::get_remote_addr(), LM_DEBUG, LM_ERROR, MAXHOSTNAMELEN, ACE_Strategy_Acceptor< SVC_HANDLER, >::open(), TAO_debug_level, TAO_SHMIOP_ACCEPT_STRATEGY, TAO_SHMIOP_CONCURRENCY_STRATEGY, and TAO_SHMIOP_CREATION_STRATEGY.

Referenced by open(), and open_default().

00252 {
00253   this->orb_core_ = orb_core;
00254 
00255   ACE_NEW_RETURN (this->creation_strategy_,
00256                   TAO_SHMIOP_CREATION_STRATEGY (this->orb_core_,
00257                                                 this->lite_flag_),
00258                   -1);
00259 
00260   ACE_NEW_RETURN (this->concurrency_strategy_,
00261                   TAO_SHMIOP_CONCURRENCY_STRATEGY (this->orb_core_),
00262                   -1);
00263 
00264   ACE_NEW_RETURN (this->accept_strategy_,
00265                   TAO_SHMIOP_ACCEPT_STRATEGY (this->orb_core_),
00266                   -1);
00267 
00268   // We only accept connection on localhost.
00269   if (this->base_acceptor_.open (this->address_,
00270                                  reactor,
00271                                  this->creation_strategy_,
00272                                  this->accept_strategy_,
00273                                  this->concurrency_strategy_) == -1)
00274     {
00275       if (TAO_debug_level > 0)
00276         ACE_ERROR ((LM_ERROR,
00277                     ACE_TEXT ("TAO (%P|%t) - SHMIOP_Acceptor::open_i, %p\n\n"),
00278                     ACE_TEXT ("cannot open acceptor")));
00279       return -1;
00280     }
00281 
00282   this->base_acceptor_.acceptor().mmap_prefix (this->mmap_file_prefix_);
00283   this->base_acceptor_.acceptor().init_buffer_size (this->mmap_size_);
00284 
00285   if (orb_core->server_factory ()->activate_server_connections () != 0)
00286     this->base_acceptor_.acceptor().preferred_strategy (ACE_MEM_IO::MT);
00287 
00288   // @@ Should this be a catastrophic error???
00289   if (this->base_acceptor_.acceptor ().get_local_addr (this->address_) != 0)
00290     {
00291       if (TAO_debug_level > 0)
00292         ACE_ERROR ((LM_ERROR,
00293                     ACE_TEXT ("TAO (%P|%t) - SHMIOP_Acceptor::open_i, %p\n\n"),
00294                     ACE_TEXT ("cannot get local addr\n")));
00295       return -1;
00296     }
00297 
00298   // If the ORB is instructed to use dotted decimal addresses, we respect that
00299   // also for shmiop
00300   if (orb_core->orb_params ()->use_dotted_decimal_addresses ())
00301     {
00302       // Get the ip address, we get the remote addr to put in the IOR, don't
00303       // calls get_host_addr() directly on address_, we then get the internal
00304       // address back
00305       const char *tmp = this->address_.get_remote_addr().get_host_addr ();
00306 
00307       if (tmp == 0)
00308         {
00309           if (TAO_debug_level > 0)
00310             ACE_ERROR ((LM_ERROR,
00311                         ACE_TEXT ("TAO (%P|%t) - ")
00312                         ACE_TEXT ("SHMIOP_Acceptor::open_i, ")
00313                         ACE_TEXT ("- %p, "),
00314                         ACE_TEXT ("cannot determine hostname\n")));
00315           return -1;
00316         }
00317 
00318       this->host_ = tmp;
00319     }
00320   else
00321     {
00322       // This will be the actualy host name of the original endpoint.
00323       ACE_TCHAR tmp_host[MAXHOSTNAMELEN+1];
00324 
00325       if (this->address_.get_host_name (tmp_host,
00326                                         sizeof tmp_host) != 0)
00327         {
00328           if (TAO_debug_level > 0)
00329             ACE_ERROR ((LM_ERROR,
00330                         ACE_TEXT ("TAO (%P|%t) - SHMIOP_Acceptor::open_i, - %p\n"),
00331                         ACE_TEXT ("cannot cache hostname\n")));
00332           return -1;
00333         }
00334       this->host_ = ACE_TEXT_ALWAYS_CHAR(tmp_host);
00335     }
00336 
00337   // This avoids having child processes acquire the listen socket thereby
00338   // denying the server the opportunity to restart on a well-known endpoint.
00339   // This does not affect the aberrent behavior on Win32 platforms.
00340   (void) this->base_acceptor_.acceptor().enable (ACE_CLOEXEC);
00341 
00342   if (TAO_debug_level > 5)
00343     {
00344       ACE_DEBUG ((LM_DEBUG,
00345                   ACE_TEXT ("TAO (%P|%t) - SHMIOP_Acceptor::open_i, ")
00346                   ACE_TEXT ("listening on : <%s:%u>\n"),
00347                   ACE_TEXT_CHAR_TO_TCHAR(this->host_.c_str ()),
00348                   this->address_.get_port_number ()));
00349     }
00350   return 0;
00351 }

int TAO_SHMIOP_Acceptor::parse_options const char *  options  )  [private, virtual]
 

Parse protocol specific options.

Definition at line 420 of file SHMIOP_Acceptor.cpp.

References ACE_CString, ACE_ERROR_RETURN, ACE_TEXT, ACE_TEXT_CHAR_TO_TCHAR, and LM_ERROR.

Referenced by open(), and open_default().

00421 {
00422   if (str == 0)
00423     return 0;  // No options to parse.  Not a problem.
00424 
00425   // Use an option format similar to the one used for CGI scripts in
00426   // HTTP URLs.
00427   // e.g.:  option1=foo&option2=bar
00428 
00429   ACE_CString options (str);
00430 
00431   size_t len = options.length ();
00432 
00433   const char option_delimiter = '&';
00434 
00435   // Count the number of options.
00436 
00437   CORBA::ULong option_count = 1;
00438   // Number of endpoints in the string  (initialized to 1).
00439 
00440   // Only check for endpoints after the protocol specification and
00441   // before the object key.
00442   for (size_t i = 0; i < len; ++i)
00443     if (options[i] == option_delimiter)
00444       option_count++;
00445 
00446   // The idea behind the following loop is to split the options into
00447   // (option, name) pairs.
00448   // For example,
00449   //    `option1=foo&option2=bar'
00450   // will be parsed into:
00451   //    `option1=foo'
00452   //    `option2=bar'
00453 
00454   int begin = 0;
00455   int end = -1;
00456 
00457   for (CORBA::ULong j = 0; j < option_count; ++j)
00458     {
00459       begin += end + 1;
00460 
00461       if (j < option_count - 1)
00462         end = options.find (option_delimiter, begin);
00463       else
00464         end = static_cast <int>(len - begin); // Handle last endpoint differently
00465 
00466       if (end == begin)
00467         ACE_ERROR_RETURN ((LM_ERROR,
00468                            ACE_TEXT ("TAO (%P|%t) Zero length SHMIOP option.\n")),
00469                           -1);
00470       else if (end != ACE_CString::npos)
00471         {
00472           ACE_CString opt = options.substring (begin, end);
00473 
00474           int slot = opt.find ("=");
00475 
00476           if (slot == static_cast <int> (len - 1)
00477               || slot == ACE_CString::npos)
00478             ACE_ERROR_RETURN ((LM_ERROR,
00479                                ACE_TEXT ("TAO (%P|%t) SHMIOP option <%s> is ")
00480                                ACE_TEXT ("missing a value.\n"),
00481                                ACE_TEXT_CHAR_TO_TCHAR(opt.c_str ())),
00482                               -1);
00483 
00484           ACE_CString name = opt.substring (0, slot);
00485           ACE_CString value = opt.substring (slot + 1);
00486 
00487           if (name.length () == 0)
00488             ACE_ERROR_RETURN ((LM_ERROR,
00489                                ACE_TEXT ("TAO (%P|%t) Zero length SHMIOP ")
00490                                ACE_TEXT ("option name.\n")),
00491                               -1);
00492 
00493           if (name == "priority")
00494             {
00495               ACE_ERROR_RETURN ((LM_ERROR,
00496                                  ACE_TEXT ("TAO (%P|%t) Invalid SHMIOP endpoint format: ")
00497                                  ACE_TEXT ("endpoint priorities no longer supported.\n")),
00498                                 -1);
00499             }
00500           else
00501             ACE_ERROR_RETURN ((LM_ERROR,
00502                                ACE_TEXT ("TAO (%P|%t) Invalid SHMIOP option: <%s>\n"),
00503                                ACE_TEXT_CHAR_TO_TCHAR(name.c_str ())),
00504                               -1);
00505         }
00506     }
00507   return 0;
00508 }

int TAO_SHMIOP_Acceptor::set_mmap_options const ACE_TCHAR prefix,
off_t  size
 

Set the MMAP options the MEM_Stream this acceptor creates will use.

Definition at line 240 of file SHMIOP_Acceptor.cpp.

References mmap_file_prefix_, and mmap_size_.

Referenced by TAO_SHMIOP_Protocol_Factory::make_acceptor().

00242 {
00243   this->mmap_file_prefix_ = prefix;
00244   this->mmap_size_ = size;
00245 
00246   return 0;
00247 }


Member Data Documentation

TAO_SHMIOP_ACCEPT_STRATEGY* TAO_SHMIOP_Acceptor::accept_strategy_ [private]
 

Definition at line 135 of file SHMIOP_Acceptor.h.

ACE_MEM_Addr TAO_SHMIOP_Acceptor::address_ [protected]
 

A local endpoint.

Definition at line 120 of file SHMIOP_Acceptor.h.

TAO_SHMIOP_BASE_ACCEPTOR TAO_SHMIOP_Acceptor::base_acceptor_ [private]
 

The concrete acceptor, as a pointer to it's base class.

Definition at line 130 of file SHMIOP_Acceptor.h.

TAO_SHMIOP_CONCURRENCY_STRATEGY* TAO_SHMIOP_Acceptor::concurrency_strategy_ [private]
 

Definition at line 134 of file SHMIOP_Acceptor.h.

TAO_SHMIOP_CREATION_STRATEGY* TAO_SHMIOP_Acceptor::creation_strategy_ [private]
 

Acceptor strategies.

Definition at line 133 of file SHMIOP_Acceptor.h.

ACE_CString TAO_SHMIOP_Acceptor::host_ [protected]
 

Cache the information about the endpoint serviced by this acceptor.

Todo:
There may in fact be multiple hostnames for this endpoint. For example it the IP address is INADDR_ANY (0.0.0.0) then there will be possibly a different hostname for each interface.

Definition at line 117 of file SHMIOP_Acceptor.h.

CORBA::Boolean TAO_SHMIOP_Acceptor::lite_flag_ [private]
 

Should we use GIOP lite??

Definition at line 145 of file SHMIOP_Acceptor.h.

const ACE_TCHAR* TAO_SHMIOP_Acceptor::mmap_file_prefix_ [private]
 

Determine the prefix (include path name) of the mmap file.

Definition at line 138 of file SHMIOP_Acceptor.h.

Referenced by set_mmap_options().

off_t TAO_SHMIOP_Acceptor::mmap_size_ [private]
 

Determine the minimum size of mmap file. This dictate the maximum size of a CORBA method invocation.

Definition at line 142 of file SHMIOP_Acceptor.h.

Referenced by set_mmap_options().

TAO_ORB_Core* TAO_SHMIOP_Acceptor::orb_core_ [protected]
 

ORB Core.

Definition at line 126 of file SHMIOP_Acceptor.h.

TAO_GIOP_Message_Version TAO_SHMIOP_Acceptor::version_ [protected]
 

The GIOP version for this endpoint.

Definition at line 123 of file SHMIOP_Acceptor.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:41:40 2006 for TAO_Strategies by doxygen 1.3.6