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 TAO_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 (void)
 Constructor.
 ~TAO_SHMIOP_Acceptor (void)
 Destructor.
int set_mmap_options (const ACE_TCHAR *prefix, ACE_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.
ACE_OFF_T mmap_size_

Detailed Description

The SHMIOP-specific bridge class for the concrete acceptor.

Definition at line 42 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 54 of file SHMIOP_Acceptor.h.

typedef TAO_Strategy_Acceptor<TAO_SHMIOP_Connection_Handler, ACE_MEM_ACCEPTOR> TAO_SHMIOP_Acceptor::TAO_SHMIOP_BASE_ACCEPTOR

Definition at line 51 of file SHMIOP_Acceptor.h.

typedef TAO_Concurrency_Strategy<TAO_SHMIOP_Connection_Handler> TAO_SHMIOP_Acceptor::TAO_SHMIOP_CONCURRENCY_STRATEGY

Definition at line 53 of file SHMIOP_Acceptor.h.

typedef TAO_Creation_Strategy<TAO_SHMIOP_Connection_Handler> TAO_SHMIOP_Acceptor::TAO_SHMIOP_CREATION_STRATEGY

Definition at line 52 of file SHMIOP_Acceptor.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_SHMIOP_Acceptor::TAO_SHMIOP_Acceptor ( void   ) 

Constructor.

Definition at line 24 of file SHMIOP_Acceptor.cpp.

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

TAO_SHMIOP_Acceptor::~TAO_SHMIOP_Acceptor ( void   ) 

Destructor.

Definition at line 37 of file SHMIOP_Acceptor.cpp.

References accept_strategy_, close(), concurrency_strategy_, and creation_strategy_.

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


Member Function Documentation

int TAO_SHMIOP_Acceptor::close ( void   )  [virtual]

Implements TAO_Acceptor.

Definition at line 178 of file SHMIOP_Acceptor.cpp.

References base_acceptor_, and ACE_Acceptor< SVC_HANDLER, >::close().

Referenced by ~TAO_SHMIOP_Acceptor().

00179 {
00180   return this->base_acceptor_.close ();
00181 }

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 67 of file SHMIOP_Acceptor.cpp.

References TAO_Profile::_decr_refcnt(), ACE_NEW_RETURN, address_, TAO_ORB_Core::codeset_manager(), TAO_SHMIOP_Profile::endpoint(), TAO_MProfile::give_profile(), TAO_MProfile::grow(), TAO_GIOP_Message_Version::major, TAO_GIOP_Message_Version::minor, orb_core_, TAO_Endpoint::priority(), TAO_MProfile::profile_count(), TAO_Codeset_Manager::set_codeset(), TAO_Tagged_Components::set_orb_type(), TAO_MProfile::size(), TAO_Profile::tagged_components(), TAO_ORB_TYPE, and version_.

Referenced by create_profile(), and create_shared_profile().

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

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

Implements TAO_Acceptor.

Definition at line 54 of file SHMIOP_Acceptor.cpp.

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

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

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 111 of file SHMIOP_Acceptor.cpp.

References ACE_NEW_RETURN, TAO_SHMIOP_Profile::add_endpoint(), address_, create_new_profile(), TAO_MProfile::get_profile(), TAO_Endpoint::priority(), TAO_MProfile::profile_count(), TAO_Profile::tag(), and TAO_TAG_SHMEM_PROFILE.

Referenced by create_profile().

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

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

Implements TAO_Acceptor.

Definition at line 405 of file SHMIOP_Acceptor.cpp.

00406 {
00407   // @@ for now just assume one!
00408   // we should take a look at the local address, if it is zero then
00409   // get the list of available IP interfaces and return this number.
00410   return 1;
00411 }

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

Implements TAO_Acceptor.

Definition at line 153 of file SHMIOP_Acceptor.cpp.

References address_, and TAO_SHMIOP_Endpoint::object_addr().

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

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

Implements TAO_Acceptor.

Definition at line 350 of file SHMIOP_Acceptor.cpp.

References ACE_DEBUG, ACE_ERROR, ACE_TEXT, LM_DEBUG, LM_ERROR, and TAO_debug_level.

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

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 184 of file SHMIOP_Acceptor.cpp.

References ACE_OS::ace_isdigit(), ACE_TEXT_CHAR_TO_TCHAR, address_, open_i(), TAO_GIOP_Message_Version::set_version(), and version_.

00190 {
00191   if (major >=0 && minor >= 0)
00192     this->version_.set_version (static_cast <CORBA::Octet>(major),
00193                                 static_cast <CORBA::Octet>(minor));
00194   // Parse options
00195   if (this->parse_options (options) == -1)
00196     return -1;
00197 
00198   if (ACE_OS::ace_isdigit (*port) == 0)
00199     return -1;                  // Port number must consist of digits
00200 
00201   if (port)
00202     this->address_.set (ACE_TEXT_CHAR_TO_TCHAR(port));
00203 
00204   return this->open_i (orb_core, reactor);
00205 }

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 208 of file SHMIOP_Acceptor.cpp.

References address_, host_, open_i(), TAO_GIOP_Message_Version::set_version(), and version_.

00213 {
00214   if (major >=0 && minor >= 0)
00215     this->version_.set_version (static_cast <CORBA::Octet>(major),
00216                                 static_cast <CORBA::Octet>(minor));
00217 
00218   // Parse options
00219   if (this->parse_options (options) == -1)
00220     return -1;
00221 
00222   // @@ Until we can support multihomed machines correctly we must
00223   //    pick the "default interface" and only listen on that IP
00224   //    address.
00225   this->host_ = this->address_.get_host_name ();
00226 
00227   return this->open_i (orb_core, reactor);
00228 }

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 240 of file SHMIOP_Acceptor.cpp.

References ACE_Strategy_Acceptor< SVC_HANDLER, >::acceptor(), ACE_CLOEXEC, ACE_DEBUG, ACE_ERROR, ACE_NEW_RETURN, ACE_TEXT, ACE_TEXT_ALWAYS_CHAR, ACE_TEXT_CHAR_TO_TCHAR, TAO_Server_Strategy_Factory::activate_server_connections(), base_acceptor_, host_, LM_DEBUG, LM_ERROR, MAXHOSTNAMELEN, orb_core_, TAO_ORB_Core::orb_params(), TAO_ORB_Core::server_factory(), TAO_Acceptor::set_error_retry_delay(), TAO_debug_level, and TAO_ORB_Parameters::use_dotted_decimal_addresses().

Referenced by open(), and open_default().

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

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

Parse protocol specific options.

Definition at line 414 of file SHMIOP_Acceptor.cpp.

References ACE_ERROR_RETURN, ACE_TEXT, ACE_TEXT_CHAR_TO_TCHAR, ACE_String_Base< CHAR >::c_str(), ACE_String_Base< CHAR >::find(), ACE_String_Base< CHAR >::length(), LM_ERROR, ACE_String_Base_Const::npos, and ACE_String_Base< CHAR >::substring().

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

int TAO_SHMIOP_Acceptor::set_mmap_options ( const ACE_TCHAR prefix,
ACE_OFF_T  size 
)

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

Definition at line 231 of file SHMIOP_Acceptor.cpp.

References mmap_file_prefix_, and mmap_size_.

Referenced by TAO_SHMIOP_Protocol_Factory::make_acceptor().

00232 {
00233   this->mmap_file_prefix_ = prefix;
00234   this->mmap_size_ = size;
00235 
00236   return 0;
00237 }


Member Data Documentation

TAO_SHMIOP_ACCEPT_STRATEGY* TAO_SHMIOP_Acceptor::accept_strategy_ [private]

Definition at line 133 of file SHMIOP_Acceptor.h.

Referenced by ~TAO_SHMIOP_Acceptor().

ACE_MEM_Addr TAO_SHMIOP_Acceptor::address_ [protected]

A local endpoint.

Definition at line 118 of file SHMIOP_Acceptor.h.

Referenced by create_new_profile(), create_shared_profile(), is_collocated(), open(), and open_default().

TAO_SHMIOP_BASE_ACCEPTOR TAO_SHMIOP_Acceptor::base_acceptor_ [private]

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

Definition at line 128 of file SHMIOP_Acceptor.h.

Referenced by close(), and open_i().

TAO_SHMIOP_CONCURRENCY_STRATEGY* TAO_SHMIOP_Acceptor::concurrency_strategy_ [private]

Definition at line 132 of file SHMIOP_Acceptor.h.

Referenced by ~TAO_SHMIOP_Acceptor().

TAO_SHMIOP_CREATION_STRATEGY* TAO_SHMIOP_Acceptor::creation_strategy_ [private]

Acceptor strategies.

Definition at line 131 of file SHMIOP_Acceptor.h.

Referenced by ~TAO_SHMIOP_Acceptor().

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 115 of file SHMIOP_Acceptor.h.

Referenced by open_default(), and open_i().

const ACE_TCHAR* TAO_SHMIOP_Acceptor::mmap_file_prefix_ [private]

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

Definition at line 136 of file SHMIOP_Acceptor.h.

Referenced by set_mmap_options().

ACE_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 140 of file SHMIOP_Acceptor.h.

Referenced by set_mmap_options().

TAO_ORB_Core* TAO_SHMIOP_Acceptor::orb_core_ [protected]

ORB Core.

Definition at line 124 of file SHMIOP_Acceptor.h.

Referenced by create_new_profile(), and open_i().

TAO_GIOP_Message_Version TAO_SHMIOP_Acceptor::version_ [protected]

The GIOP version for this endpoint.

Definition at line 121 of file SHMIOP_Acceptor.h.

Referenced by create_new_profile(), open(), and open_default().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:47:33 2010 for TAO_Strategies by  doxygen 1.4.7