Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes

TAO_UIPMC_Profile Class Reference

This class defines the protocol specific attributes required for locating ORBs over a TCP/IP network. More...

#include <UIPMC_Profile.h>

Inheritance diagram for TAO_UIPMC_Profile:
Inheritance graph
[legend]
Collaboration diagram for TAO_UIPMC_Profile:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual char object_key_delimiter (void) const
 TAO_UIPMC_Profile (TAO_ORB_Core *orb_core)
 TAO_UIPMC_Profile (const ACE_INET_Addr &addr, TAO_ORB_Core *orb_core)
 TAO_UIPMC_Profile (const CORBA::Octet class_d_address[4], CORBA::UShort port, TAO_ORB_Core *orb_core)
 Profile constructor. @ Vadym - deprecate this.
 TAO_UIPMC_Profile (const char *string, TAO_ORB_Core *orb_core)
 Create object using a string ior.
 ~TAO_UIPMC_Profile (void)
 Destructor is to be called only through <_decr_refcnt>.
virtual int decode (TAO_InputCDR &cdr)
 Template methods. Please see tao/Profile.h for documentation.
virtual void parse_string (const char *string)
virtual char * to_string (void)
virtual int encode_endpoints (void)
virtual TAO_Endpointendpoint (void)
virtual CORBA::ULong endpoint_count (void) const
virtual CORBA::ULong hash (CORBA::ULong max)
virtual IOP::TaggedProfile & create_tagged_profile (void)
virtual void request_target_specifier (TAO_Target_Specification &target_spec, TAO_Target_Specification::TAO_Target_Address r)
virtual int supports_multicast (void) const
virtual void addressing_mode (CORBA::Short addr_mode)
void set_group_info (const char *domain_id, PortableGroup::ObjectGroupId group_id, PortableGroup::ObjectGroupRefVersion ref_version)
 Add the mandatory group component to this profile.

Static Public Member Functions

static const char * prefix (void)
 Return the char string prefix.
static int extract_group_component (const IOP::TaggedProfile &profile, PortableGroup::TagGroupTaggedComponent &group)

Static Public Attributes

static const char object_key_delimiter_ = '/'
 The object key delimiter that UIPMC uses or expects.

Protected Member Functions

virtual int decode_profile (TAO_InputCDR &cdr)
 Template methods, please see documentation in tao/Profile.h.
virtual int decode_endpoints (void)
virtual void parse_string_i (const char *)
virtual void create_profile_body (TAO_OutputCDR &cdr) const
virtual CORBA::Boolean do_is_equivalent (const TAO_Profile *other_profile)
virtual void update_cached_group_component (void)

Protected Attributes

TAO_UIPMC_Endpoint endpoint_

Private Attributes

IOP::TaggedProfile tagged_profile_
 Cached version of our tagged profile.
ACE_CString group_domain_id_
 Group Domain ID.
PortableGroup::ObjectGroupId group_id_
 Our group ID within the group domain.
PortableGroup::ObjectGroupRefVersion ref_version_
 The group reference's version.
bool has_ref_version_
 A sign whether ref_version is really present.

Detailed Description

This class defines the protocol specific attributes required for locating ORBs over a TCP/IP network.

This class defines the UIPMC profile as specified in the CORBA specification.

Note:
This class inherits the ObjectKey from TAO_Profile which may not be needed at all! But lets punt on this for the timebeing.

Definition at line 51 of file UIPMC_Profile.h.


Constructor & Destructor Documentation

TAO_UIPMC_Profile::TAO_UIPMC_Profile ( TAO_ORB_Core orb_core  ) 

Profile constructor, default. Used when the profile contents are not yet known or when it is being decoded from an IOR.

Definition at line 35 of file UIPMC_Profile.cpp.

  : TAO_Profile (IOP::TAG_UIPMC,
                 orb_core,
                 TAO_GIOP_Message_Version (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR)),
    endpoint_ (),
    tagged_profile_ ()
{
    addressing_mode_ = default_addressing_mode_;
}

TAO_UIPMC_Profile::TAO_UIPMC_Profile ( const ACE_INET_Addr addr,
TAO_ORB_Core orb_core 
)

Profile constructor, same as above except the object_key has already been marshaled.

Definition at line 45 of file UIPMC_Profile.cpp.

  : TAO_Profile (IOP::TAG_UIPMC,
                 orb_core,
                 TAO_GIOP_Message_Version (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR)),
    endpoint_ (addr),
    tagged_profile_ ()
{
    addressing_mode_ = default_addressing_mode_;
}

TAO_UIPMC_Profile::TAO_UIPMC_Profile ( const CORBA::Octet  class_d_address[4],
CORBA::UShort  port,
TAO_ORB_Core orb_core 
)

Profile constructor. @ Vadym - deprecate this.

Definition at line 56 of file UIPMC_Profile.cpp.

  : TAO_Profile (IOP::TAG_UIPMC,
                 orb_core,
                 TAO_GIOP_Message_Version (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR)),
    endpoint_ (class_d_address, port),
    tagged_profile_ ()
{
    addressing_mode_ = default_addressing_mode_;
}

TAO_UIPMC_Profile::TAO_UIPMC_Profile ( const char *  string,
TAO_ORB_Core orb_core 
)

Create object using a string ior.

TAO_UIPMC_Profile::~TAO_UIPMC_Profile ( void   ) 

Destructor is to be called only through <_decr_refcnt>.

Definition at line 85 of file UIPMC_Profile.cpp.

{
}


Member Function Documentation

void TAO_UIPMC_Profile::addressing_mode ( CORBA::Short  addr_mode  )  [virtual]

Reimplemented from TAO_Profile.

Definition at line 811 of file UIPMC_Profile.cpp.

{
  // ** See race condition note about addressing mode in Profile.h **
  switch (addr_mode)
    {
    case TAO_Target_Specification::Profile_Addr:
    case TAO_Target_Specification::Reference_Addr:
      this->addressing_mode_ = addr_mode;
      break;

    case TAO_Target_Specification::Key_Addr:
      // There is no object key, so it is not supported.

    default:
      throw CORBA::BAD_PARAM (
        CORBA::SystemException::_tao_minor_code (
          TAO::VMCID,
          EINVAL),
        CORBA::COMPLETED_NO);
    }
}

void TAO_UIPMC_Profile::create_profile_body ( TAO_OutputCDR cdr  )  const [protected, virtual]

Implements TAO_Profile.

Definition at line 638 of file UIPMC_Profile.cpp.

{
  encap.write_octet (TAO_ENCAP_BYTE_ORDER);

  // The GIOP version
  // Note: Only GIOP 1.2 and above are supported currently for MIOP.
  encap.write_octet (this->version_.major);
  encap.write_octet (this->version_.minor);

  // Address.
  encap.write_string (this->endpoint_.host ());

  // Port number.
  encap.write_ushort (this->endpoint_.port ());

  // UIPMC is only supported by versions of GIOP that have tagged components,
  // so unconditionally encode the components.
  this->tagged_components ().encode (encap);
}

IOP::TaggedProfile & TAO_UIPMC_Profile::create_tagged_profile ( void   )  [virtual]

Reimplemented from TAO_Profile.

Definition at line 598 of file UIPMC_Profile.cpp.

{
  // Check whether we have already created the TaggedProfile
  if (this->tagged_profile_.profile_data.length () == 0)
    {
      // As we have not created we will now create the TaggedProfile
      this->tagged_profile_.tag = IOP::TAG_UIPMC;

      // Create the encapsulation....
      TAO_OutputCDR encap;

      // Create the profile body
      this->create_profile_body (encap);

      CORBA::ULong length =
        static_cast<CORBA::ULong> (encap.total_length ());

#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
      // Place the message block in to the Sequence of Octets that we
      // have
      this->tagged_profile_.profile_data.replace (length,
                                                  encap.begin ());
#else
      this->tagged_profile_.profile_data.length (length);
      CORBA::Octet *buffer =
        this->tagged_profile_.profile_data.get_buffer ();
      for (const ACE_Message_Block *i = encap.begin ();
           i != encap.end ();
           i = i->next ())
        {
          ACE_OS::memcpy (buffer, i->rd_ptr (), i->length ());
          buffer += i->length ();
        }
#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */
    }

  return this->tagged_profile_;
}

int TAO_UIPMC_Profile::decode ( TAO_InputCDR cdr  )  [virtual]

Template methods. Please see tao/Profile.h for documentation.

N.B. We have to override the TAO_Profile default decode because in UIPMC there is no object key marshalled and we do not implement a useable decode_endpoints

Reimplemented from TAO_Profile.

Definition at line 90 of file UIPMC_Profile.cpp.

{
  // The following is a selective reproduction of TAO_Profile::decode

  CORBA::ULong encap_len = cdr.length ();

  // Read and verify major, minor versions, ignoring profiles
  // whose versions we don't understand.
  if (!(cdr.read_octet (this->version_.major)
        && this->version_.major == TAO_DEF_GIOP_MAJOR
        && cdr.read_octet (this->version_.minor)
        && this->version_.minor <= TAO_DEF_GIOP_MINOR))
    {
      if (TAO_debug_level > 0)
        {
          ACE_DEBUG ((LM_DEBUG,
                      ACE_TEXT ("TAO (%P|%t) - UIPMC_Profile::decode - v%d.%d\n"),
                      this->version_.major,
                      this->version_.minor));
        }

      return -1;
    }

  // Transport specific details
  if (this->decode_profile (cdr) < 0)
    {
      return -1;
    }

  // UIPMC profiles must have tagged components.
  if (this->tagged_components_.decode (cdr) == 0)
    {
      return -1;
    }

  if (cdr.length () != 0 && TAO_debug_level)
    {
      // If there is extra data in the profile we are supposed to
      // ignore it, but print a warning just in case...
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("%d bytes out of %d left after profile data\n"),
                  cdr.length (),
                  encap_len));
    }

  // We don't call ::decode_endpoints because it is implemented
  // as ACE_NOTSUP_RETURN (-1) for this profile

  return 1;
}

int TAO_UIPMC_Profile::decode_endpoints ( void   )  [protected, virtual]

Implements TAO_Profile.

Definition at line 143 of file UIPMC_Profile.cpp.

int TAO_UIPMC_Profile::decode_profile ( TAO_InputCDR cdr  )  [protected, virtual]

Template methods, please see documentation in tao/Profile.h.

Implements TAO_Profile.

Definition at line 149 of file UIPMC_Profile.cpp.

{
  CORBA::UShort port = 0;
  ACE_CString address;
  if (!(cdr.read_string (address)
        && cdr.read_ushort (port)))
    {
      if (TAO_debug_level > 0)
        ACE_DEBUG ((LM_DEBUG,
                    ACE_TEXT ("TAO (%P|%t) - UIPMC_Profile::decode - ")
                    ACE_TEXT ("Couldn't unmarshal address and port!\n")));
      return -1;
    }

  if (cdr.good_bit ())
    {
      // If everything was successful, update the endpoint's address
      // and port with the new data.
      ACE_INET_Addr addr (port, address.c_str ());
      this->endpoint_.object_addr (addr);
      return 1;
    }

  return -1;
}

CORBA::Boolean TAO_UIPMC_Profile::do_is_equivalent ( const TAO_Profile other_profile  )  [protected, virtual]

Implements TAO_Profile.

Definition at line 480 of file UIPMC_Profile.cpp.

{
  const TAO_UIPMC_Profile *op =
    dynamic_cast<const TAO_UIPMC_Profile *> (other_profile);

  if (op == 0)
    return 0;

  return this->endpoint_.is_equivalent (&op->endpoint_);
}

int TAO_UIPMC_Profile::encode_endpoints ( void   )  [virtual]

Implements TAO_Profile.

Definition at line 510 of file UIPMC_Profile.cpp.

{
  return 1;
}

TAO_Endpoint * TAO_UIPMC_Profile::endpoint ( void   )  [virtual]

Implements TAO_Profile.

Definition at line 504 of file UIPMC_Profile.cpp.

{
  return &this->endpoint_;
}

CORBA::ULong TAO_UIPMC_Profile::endpoint_count ( void   )  const [virtual]

Implements TAO_Profile.

Definition at line 516 of file UIPMC_Profile.cpp.

{
  return 1;
}

int TAO_UIPMC_Profile::extract_group_component ( const IOP::TaggedProfile &  profile,
PortableGroup::TagGroupTaggedComponent &  group 
) [static]

Definition at line 834 of file UIPMC_Profile.cpp.

{
  // Create the decoding stream from the encapsulation in the buffer,
//#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
//  TAO_InputCDR cdr (profile.profile_data.mb ());
//#else
  TAO_InputCDR cdr (reinterpret_cast<const char*> (profile.profile_data.get_buffer ()),
                    profile.profile_data.length ());
//#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */

  // Extract the Byte Order.
  CORBA::Boolean byte_order;
  if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0)
    return -1;
  cdr.reset_byte_order (static_cast<int> (byte_order));

  // Read and verify major, minor versions, ignoring UIPMC profiles
  // whose versions we don't understand.
  CORBA::Octet major;
  CORBA::Octet minor = CORBA::Octet();

  // Read the version. We just read it here. We don't*do any*
  // processing.
  if (!(cdr.read_octet (major)
        && cdr.read_octet (minor)))
  {
    if (TAO_debug_level > 0)
      {
        ACE_DEBUG ((LM_DEBUG,
                    ACE_TEXT ("TAO (%P|%t) - UIPMC_Profile::extract_group_component - v%d.%d\n"),
                    major,
                    minor));
      }
    return -1;
  }

  // Decode the endpoint.
  ACE_CString address;
  CORBA::UShort port;

  if (!(cdr.read_string (address)
        && cdr.read_ushort (port)))
    {
      if (TAO_debug_level > 0)
        ACE_DEBUG ((LM_DEBUG,
                    ACE_TEXT ("TAO (%P|%t) - UIPMC_Profile::extract_group_component - Couldn't unmarshal address and port!\n")));
      return -1;
    }

  TAO_Tagged_Components tagged_components;
  if (tagged_components.decode (cdr) == 0)
    return -1;

  IOP::TaggedComponent tagged_component;
  tagged_component.tag = IOP::TAG_GROUP;

  // Try to find it.
  if (tagged_components.get_component (tagged_component) == 0)
    return -1;

  // Found it.
  const CORBA::Octet *buf =
    tagged_component.component_data.get_buffer ();

  TAO_InputCDR in_cdr (reinterpret_cast<const char*> (buf),
                       tagged_component.component_data.length ());

  // Extract the Byte Order.
  if ((in_cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0)
    return -1;
  in_cdr.reset_byte_order (static_cast<int> (byte_order));

  if ((in_cdr >> group) == 0)
    return -1;

  return 0;
}

CORBA::ULong TAO_UIPMC_Profile::hash ( CORBA::ULong  max  )  [virtual]

Implements TAO_Profile.

Definition at line 492 of file UIPMC_Profile.cpp.

{
  // Get the hashvalue for all endpoints.
  CORBA::ULong hashval = this->endpoint_.hash ();

  hashval += this->version_.minor;
  hashval += this->tag ();

  return hashval % max;
}

char TAO_UIPMC_Profile::object_key_delimiter ( void   )  const [virtual]

Implements TAO_Profile.

Definition at line 30 of file UIPMC_Profile.cpp.

void TAO_UIPMC_Profile::parse_string ( const char *  string  )  [virtual]

Reimplemented from TAO_Profile.

Definition at line 176 of file UIPMC_Profile.cpp.

{
  this->parse_string_i (string);
}

void TAO_UIPMC_Profile::parse_string_i ( const char *  string  )  [protected, virtual]

Implements TAO_Profile.

Definition at line 182 of file UIPMC_Profile.cpp.

{
  // Remove the "N.n@" version prefix, if it exists, and verify the
  // version is one that we accept.

  // Check for MIOP version
  if (ACE_OS::ace_isdigit (string [0]) &&
      string[1] == '.' &&
      ACE_OS::ace_isdigit (string [2]) &&
      string[3] == '@')
    {
      if (string[0] != '1' ||
          string[2] != '0')
        {
          throw CORBA::INV_OBJREF (
            CORBA::SystemException::_tao_minor_code (
              TAO::VMCID,
              EINVAL),
            CORBA::COMPLETED_NO);
        }

      string += 4;
      // Skip over the "N.n@"
    }

  // UIPMC profiles always use GIOP 1.2
  this->version_.set_version (1, 2);

  //
  // Parse the group_id.
  //

  // Parse the group component version.
  if (ACE_OS::ace_isdigit (string [0]) &&
      string[1] == '.' &&
      ACE_OS::ace_isdigit (string [2]) &&
      string[3] == '-')
    {
      CORBA::Char major;
      CORBA::Char minor;

      major = (char) (string [0] - '0');
      minor = (char) (string [2] - '0');

      // Verify that a supported version of MIOP is specified.
      if (major != TAO_DEF_MIOP_MAJOR ||
          minor >  TAO_DEF_MIOP_MINOR)
        {
          throw CORBA::INV_OBJREF (
            CORBA::SystemException::_tao_minor_code (
              TAO::VMCID,
              EINVAL),
            CORBA::COMPLETED_NO);
        }

      // Skip over "N.n-"
      string += 4;
    }
  else
    {
      // The group component version is mandatory.
      throw CORBA::INV_OBJREF (
        CORBA::SystemException::_tao_minor_code (
          TAO::VMCID,
          EINVAL),
        CORBA::COMPLETED_NO);
    }

  // Parse the group_domain_id.
  // The Domain ID is terminated with a '-'.

  // Look for the group domain delimitor.
  const char *pos = ACE_OS::strchr (string, '-');

  if (pos == 0)
    {
      // The group_domain_id is mandatory, so throw an
      // exception if it isn't found.
      throw CORBA::INV_OBJREF (
        CORBA::SystemException::_tao_minor_code (
          TAO::VMCID,
          EINVAL),
        CORBA::COMPLETED_NO);
    }

  // Save the group_domain_id.
  ACE_CString group_domain_id (string, pos - string);

  // Parse the group_id.
  // The group_id is terminated with a '-' or a '/'.

  // Skip past the last '-'.
  string = pos + 1;
  pos = ACE_OS::strchr (string, '-');

  CORBA::Boolean parse_group_ref_version_flag = 0;

  if (pos != 0)
    {
      // String was terminated by a '-', so there's a group
      // reference version to be parsed.
      parse_group_ref_version_flag = 1;
    }
  else
    {
      // Look for a slash as the separator.
      pos = ACE_OS::strchr (string, '/');

      if (pos == 0)
        {
          // The Group ID is mandatory, so throw an exception.
          throw CORBA::INV_OBJREF (
            CORBA::SystemException::_tao_minor_code (
              TAO::VMCID,
              EINVAL),
            CORBA::COMPLETED_NO);
        }
    }

  if (ACE_OS::strspn (string, "0123456789") !=
      static_cast<size_t> (pos - string))
    {
      // Throw an exception if it's not a proper number
      throw CORBA::INV_OBJREF (
        CORBA::SystemException::_tao_minor_code (
          TAO::VMCID,
          EINVAL),
        CORBA::COMPLETED_NO);
    }

  // Get the group_id.
  ACE_CString str_group_id (string, pos - string);

  // Convert the group_id into numerical form.
  PortableGroup::ObjectGroupId group_id =
    ACE_OS::strtoull (str_group_id.c_str (), 0, 10);

  this->has_ref_version_ = false;
  PortableGroup::ObjectGroupRefVersion ref_version = 0;
  if (parse_group_ref_version_flag)
    {
      // Try to find the group version.  It is terminated by a '/'.
      string = pos + 1;
      pos = ACE_OS::strchr (string, '/');
      if (pos == 0)
        {
          // The group version was expected but not found,
          // so throw an exception.
          throw CORBA::INV_OBJREF (
            CORBA::SystemException::_tao_minor_code (
              TAO::VMCID,
              EINVAL),
            CORBA::COMPLETED_NO);
        }

      if (ACE_OS::strspn (string, "0123456789") !=
          static_cast<size_t> (pos - string))
        {
          // Throw an exception if it's not a proper number
          throw CORBA::INV_OBJREF (
            CORBA::SystemException::_tao_minor_code (
              TAO::VMCID,
              EINVAL),
            CORBA::COMPLETED_NO);
        }

      ACE_CString str_group_ref_ver (string, pos - string);

      ref_version =
        ACE_OS::strtoul (str_group_ref_ver.c_str (), 0, 10);
      this->has_ref_version_ = true;
    }

  // Parse the group multicast address.
  // The multicast address is terminated by a ':'.
  string = pos + 1;
  pos = ACE_OS::strchr (string, ':');

  if (pos == 0)
    {
      // The multicast address is mandatory, so throw an exception,
      // since it wasn't found.
      throw CORBA::INV_OBJREF (
        CORBA::SystemException::_tao_minor_code (
          TAO::VMCID,
          EINVAL),
        CORBA::COMPLETED_NO);
    }

  ACE_CString mcast_addr;

#if defined (ACE_HAS_IPV6)
  // Check if this is a (possibly) IPv6 supporting profile containing a
  // decimal IPv6 address representation.
  if ((this->version ().major > TAO_MIN_IPV6_IIOP_MAJOR ||
        this->version ().minor >= TAO_MIN_IPV6_IIOP_MINOR) &&
      string[0] == '[')
    {
      // In this case we have to find the end of the numeric address and
      // start looking for the port separator from there.
      pos = ACE_OS::strchr (string, ']');
      if (pos == 0)
        {
          // No valid IPv6 address specified.
          if (TAO_debug_level > 0)
            {
              ACE_ERROR ((LM_ERROR,
                          ACE_TEXT ("\nTAO (%P|%t) - UIPMC_Profile: ")
                          ACE_TEXT ("Invalid IPv6 decimal address specified.\n")));
            }

          throw CORBA::INV_OBJREF (
            CORBA::SystemException::_tao_minor_code (
              0,
              EINVAL),
            CORBA::COMPLETED_NO);
        }
      else
        {
          ++string;
          mcast_addr = ACE_CString (string, pos - string);
          string = pos + 2;
        }
    }
  else
    {
#endif /* ACE_HAS_IPV6 */
      mcast_addr = ACE_CString (string, pos - string);
      string = pos + 1;
#if defined (ACE_HAS_IPV6)
    }
#endif /* ACE_HAS_IPV6 */

  size_t mcast_addr_len = mcast_addr.length ();
  if (ACE_OS::strspn (mcast_addr.c_str (),
                      ".:0123456789ABCDEFabcdef") != mcast_addr_len)
    {
      // Throw an exception if it's not a proper IPv4/IPv6 address
      throw CORBA::INV_OBJREF (
        CORBA::SystemException::_tao_minor_code (
          TAO::VMCID,
          EINVAL),
        CORBA::COMPLETED_NO);
    }

  // Parse the multicast port number.

  // First check that there's something left in the string.
  if (string[0] == '\0')
    {
      // The multicast port is mandatory, so throw an exception,
      // since it wasn't found.
      throw CORBA::INV_OBJREF (
        CORBA::SystemException::_tao_minor_code (
          TAO::VMCID,
          EINVAL),
        CORBA::COMPLETED_NO);
    }

  // Port can have name thus letters and '-' are allowed.
  const char port_chars[] =
    "-0123456789ABCDEFGHIGKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  size_t port_len = ACE_OS::strlen (string);
  if (ACE_OS::strspn (string, port_chars) != port_len)
    {
      // Throw an exception if it's not a proper port
      throw CORBA::INV_OBJREF (
        CORBA::SystemException::_tao_minor_code (
          TAO::VMCID,
          EINVAL),
        CORBA::COMPLETED_NO);
    }

  ACE_INET_Addr ia;
  if (ia.string_to_addr (string) == -1)
    {
      throw CORBA::INV_OBJREF (
        CORBA::SystemException::_tao_minor_code (
          TAO::VMCID,
          EINVAL),
        CORBA::COMPLETED_NO);
    }

  u_short mcast_port = ia.get_port_number ();

  //
  // Finally, set all of the fields of the profile.
  //

  ACE_INET_Addr addr (mcast_port, mcast_addr.c_str ());
  this->endpoint_.object_addr (addr);

  this->set_group_info (group_domain_id.c_str (),
                        group_id,
                        ref_version);
}

const char * TAO_UIPMC_Profile::prefix ( void   )  [static]

Return the char string prefix.

Definition at line 592 of file UIPMC_Profile.cpp.

void TAO_UIPMC_Profile::request_target_specifier ( TAO_Target_Specification target_spec,
TAO_Target_Specification::TAO_Target_Address  r 
) [virtual]

Definition at line 779 of file UIPMC_Profile.cpp.

{
  // Fill out the target specifier based on the required type.
  switch (required_type)
    {
    case TAO_Target_Specification::Profile_Addr:

      // Only using a profile as the target specifier is supported
      // at this time.  Object keys are strictly not supported since
      // UIPMC profiles do not have object keys.
      target_spec.target_specifier (
            this->create_tagged_profile ());
      break;

    case TAO_Target_Specification::Key_Addr:
    case TAO_Target_Specification::Reference_Addr:
    default:
      // Unsupported or unknown required type.  Throw an exception.
      throw CORBA::MARSHAL ();
    }
}

void TAO_UIPMC_Profile::set_group_info ( const char *  domain_id,
PortableGroup::ObjectGroupId  group_id,
PortableGroup::ObjectGroupRefVersion  ref_version 
)

Add the mandatory group component to this profile.

Definition at line 716 of file UIPMC_Profile.cpp.

{
  // First, record the group information.
  this->group_domain_id_.set (domain_id);
  this->group_id_ = group_id;
  this->ref_version_ = ref_version;

  // Update the cached version of the group component.
  this->update_cached_group_component ();
}

int TAO_UIPMC_Profile::supports_multicast ( void   )  const [virtual]

Reimplemented from TAO_Profile.

Definition at line 804 of file UIPMC_Profile.cpp.

{
  // Yes!  We support multicast!
  return 1;
}

char * TAO_UIPMC_Profile::to_string ( void   )  [virtual]

Implements TAO_Profile.

Definition at line 522 of file UIPMC_Profile.cpp.

{
  // corbaloc:miop:1.2@1.0-group_id-1-1/host:port

  size_t buflen = (8 /* "corbaloc" */ +
                   1 /* colon separator */ +
                   ACE_OS::strlen (::the_prefix) + /* "miop" */
                   1 /* colon separator */ +
                   1 /* major version */ +
                   1 /* decimal point */ +
                   1 /* minor version */ +
                   1 /* `@' character */ +
                   1 /* component major version */ +
                   1 /* decimal point */ +
                   1 /* component minor version */ +
                   1 /* `-' character */ +
                   this->group_domain_id_.length () + /* domain id */
                   1 /* `-' character */ +
                   20 /* group id */ +
                   1 /* `-' character */ +
                   10 /* group reference version */ +
                   1 /* `/' character */ +
                   39 /* IPv4/IPv6 address */ +
                   1 /* colon separator */ +
                   5 /* port number */);
#if defined (ACE_HAS_IPV6)
  if (this->endpoint_.object_addr ().get_type () == AF_INET6)
    buflen += 2; // room for '[' and ']'
#endif /* ACE_HAS_IPV6 */

  static const char digits [] = "0123456789";

  char * buf = CORBA::string_alloc (static_cast<CORBA::ULong> (buflen));

  ACE_OS::sprintf (buf,
                   "corbaloc:%s:%c.%c@%c.%c-%s-%llu",
                   ::the_prefix,
                   digits [this->version_.major],
                   digits [this->version_.minor],
                   digits [TAO_DEF_MIOP_MAJOR],
                   digits [TAO_DEF_MIOP_MINOR],
                   this->group_domain_id_.c_str (),
                   this->group_id_);

  if (this->has_ref_version_)
    {
      ACE_OS::sprintf (&buf[ACE_OS::strlen (buf)],
                       "-%lu",
                       this->ref_version_);
    }

#if defined (ACE_HAS_IPV6)
  if (this->endpoint_.object_addr ().get_type () == AF_INET6)
    {
      ACE_OS::sprintf (&buf[ACE_OS::strlen (buf)],
                       "/[%s]:%d",
                       this->endpoint_.host (),
                       this->endpoint_.port ());
    }
  else
#endif /* ACE_HAS_IPV6 */
  ACE_OS::sprintf (&buf[ACE_OS::strlen (buf)],
                   "/%s:%d",
                   this->endpoint_.host (),
                   this->endpoint_.port ());

  return buf;
}

void TAO_UIPMC_Profile::update_cached_group_component ( void   )  [protected, virtual]

Definition at line 730 of file UIPMC_Profile.cpp.

{
  PortableGroup::TagGroupTaggedComponent group;

  // Encode the data structure.
  group.component_version.major = TAO_DEF_MIOP_MAJOR;
  group.component_version.minor = TAO_DEF_MIOP_MINOR;

  group.group_domain_id = CORBA::string_dup (this->group_domain_id_.c_str ());
  group.object_group_id = this->group_id_;
  group.object_group_ref_version = this->ref_version_;

  TAO_OutputCDR out_cdr;

  // Write the byte order.
  out_cdr << ACE_OutputCDR::from_boolean (ACE_CDR_BYTE_ORDER);

  // Write the group information.
  if ((out_cdr << group) == 0)
    {
      ACE_DEBUG ((LM_DEBUG,
                  "Error marshaling group component!"));
      return;
    }

  size_t length = out_cdr.total_length ();

  IOP::TaggedComponent tagged_component;
  tagged_component.tag = IOP::TAG_GROUP;
  tagged_component.component_data.length (static_cast<CORBA::ULong> (length));
  CORBA::Octet *buf =
    tagged_component.component_data.get_buffer ();

  for (const ACE_Message_Block *iterator = out_cdr.begin ();
       iterator != 0;
       iterator = iterator->cont ())
    {
      size_t i_length = iterator->length ();
      ACE_OS::memcpy (buf, iterator->rd_ptr (), i_length);

      buf += i_length;
    }

  // Add component with encoded endpoint data to this profile's
  // TaggedComponents.
  this->tagged_components_.set_component (tagged_component);
}


Member Data Documentation

Head of this profile's list of endpoints. This endpoint is not dynamically allocated because a profile always contains at least one endpoint.

Currently, a profile contains more than one endpoint, i.e., list contains more than just the head, only when RTCORBA is enabled. However, in the near future, this will be used in nonRT mode as well, e.g., to support TAG_ALTERNATE_IIOP_ADDRESS feature. Addressing info of the default endpoint, i.e., head of the list, is transmitted using standard UIPMC ProfileBody components. See <encode_endpoints> method documentation above for how the rest of the endpoint list is transmitted.

Definition at line 135 of file UIPMC_Profile.h.

Group Domain ID.

Definition at line 143 of file UIPMC_Profile.h.

PortableGroup::ObjectGroupId TAO_UIPMC_Profile::group_id_ [private]

Our group ID within the group domain.

Definition at line 146 of file UIPMC_Profile.h.

A sign whether ref_version is really present.

Definition at line 152 of file UIPMC_Profile.h.

const char TAO_UIPMC_Profile::object_key_delimiter_ = '/' [static]

The object key delimiter that UIPMC uses or expects.

Definition at line 55 of file UIPMC_Profile.h.

PortableGroup::ObjectGroupRefVersion TAO_UIPMC_Profile::ref_version_ [private]

The group reference's version.

Definition at line 149 of file UIPMC_Profile.h.

IOP::TaggedProfile TAO_UIPMC_Profile::tagged_profile_ [private]

Cached version of our tagged profile.

Reimplemented from TAO_Profile.

Definition at line 140 of file UIPMC_Profile.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines