Classes | Public Types | Public Member Functions | Private Attributes

ACE_Name_Reply Class Reference

Message format for delivering replies from the ACE_Name Server. More...

#include <Name_Request_Reply.h>

Collaboration diagram for ACE_Name_Reply:
Collaboration graph
[legend]

List of all members.

Classes

struct  Transfer

Public Types

enum  Constants { MAX_NAME_LENGTH = MAXPATHLEN + 1 }

Public Member Functions

 ACE_Name_Reply (void)
 Default constructor.
 ACE_Name_Reply (ACE_UINT32 type, ACE_UINT32 err)
 Create a ACE_Name_Reply message.
void init (void)
ACE_UINT32 length (void) const
void length (ACE_UINT32)
ACE_INT32 msg_type (void) const
void msg_type (ACE_INT32)
ACE_INT32 status (void) const
void status (ACE_INT32)
ACE_UINT32 errnum (void) const
void errnum (ACE_UINT32)
int encode (void *&)
 Encode the message before transfer.
int decode (void)
 Decode a message after reception.
void dump (void) const
 Print out the values of the message for debugging purposes.

Private Attributes

Transfer transfer_
 Transfer buffer.

Detailed Description

Message format for delivering replies from the ACE_Name Server.

This class is implemented to minimize data copying. In particular, all marshaling is done in situ...

Definition at line 196 of file Name_Request_Reply.h.


Member Enumeration Documentation

Enumerator:
MAX_NAME_LENGTH 

Class-specific constant values.

Definition at line 199 of file Name_Request_Reply.h.

  {
    /// Class-specific constant values.
    MAX_NAME_LENGTH = MAXPATHLEN + 1
  };


Constructor & Destructor Documentation

ACE_Name_Reply::ACE_Name_Reply ( void   ) 

Default constructor.

Definition at line 419 of file Name_Request_Reply.cpp.

{
  ACE_TRACE ("ACE_Name_Reply::ACE_Name_Reply");

  // Initialize to a known quantity.
  this->msg_type (0);
  this->errnum (0);
  this->length (sizeof this->transfer_);
}

ACE_Name_Reply::ACE_Name_Reply ( ACE_UINT32  type,
ACE_UINT32  err 
)

Create a ACE_Name_Reply message.

Definition at line 431 of file Name_Request_Reply.cpp.

{
  ACE_TRACE ("ACE_Name_Reply::ACE_Name_Reply");
  this->msg_type (t);
  this->errnum (err);
  this->length (sizeof this->transfer_);
}


Member Function Documentation

int ACE_Name_Reply::decode ( void   ) 

Decode a message after reception.

Definition at line 536 of file Name_Request_Reply.cpp.

{
  ACE_TRACE ("ACE_Name_Reply::decode");
  this->transfer_.length_ = ACE_NTOHL (this->transfer_.length_);
  this->transfer_.type_ = ACE_NTOHL (this->transfer_.type_);
  this->transfer_.errno_ = ACE_NTOHL (this->transfer_.errno_);
  return 0;
}

void ACE_Name_Reply::dump ( void   )  const

Print out the values of the message for debugging purposes.

Definition at line 548 of file Name_Request_Reply.cpp.

{
#if defined (ACE_HAS_DUMP)
  ACE_TRACE ("ACE_Name_Reply::dump");
  ACE_DEBUG ((LM_DEBUG,
              ACE_TEXT ("*******\nlength = %d\nerrnum = %d"),
              this->length (),
              this->errnum ()));
  ACE_DEBUG ((LM_DEBUG,
              ACE_TEXT ("type = ")));
  switch (this->msg_type ())
    {
    case 0:
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("SUCCESS\n")));
      break;
    case -1:
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("FAILURE\n")));
      break;
    default:
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("<unknown type> = %d\n"),
                  this->msg_type ()));
      break;
    }
#endif /* ACE_HAS_DUMP */
}

int ACE_Name_Reply::encode ( void *&  buf  ) 

Encode the message before transfer.

Definition at line 520 of file Name_Request_Reply.cpp.

{
  ACE_TRACE ("ACE_Name_Reply::encode");
  int len = this->length (); // Get length *before* marshaling.

  this->transfer_.length_ = ACE_HTONL (this->transfer_.length_);
  this->transfer_.type_ = ACE_HTONL (this->transfer_.type_);
  this->transfer_.errno_ = ACE_HTONL (this->transfer_.errno_);
  buf = (void *) &this->transfer_;
  return len;
}

void ACE_Name_Reply::errnum ( ACE_UINT32  e  ) 

Definition at line 510 of file Name_Request_Reply.cpp.

{
  ACE_TRACE ("ACE_Name_Reply::errnum");
  this->transfer_.errno_ = e;
}

ACE_UINT32 ACE_Name_Reply::errnum ( void   )  const

Definition at line 503 of file Name_Request_Reply.cpp.

{
  ACE_TRACE ("ACE_Name_Reply::errnum");
  return this->transfer_.errno_;
}

void ACE_Name_Reply::init ( void   ) 

Initialize length_ in order to ensure correct byte ordering before a reply is sent.

Definition at line 442 of file Name_Request_Reply.cpp.

{
  ACE_TRACE ("ACE_Name_Reply::init");
  this->length (sizeof this->transfer_);
}

ACE_UINT32 ACE_Name_Reply::length ( void   )  const

Definition at line 451 of file Name_Request_Reply.cpp.

{
  ACE_TRACE ("ACE_Name_Reply::length");
  return this->transfer_.length_;
}

void ACE_Name_Reply::length ( ACE_UINT32  l  ) 

Definition at line 458 of file Name_Request_Reply.cpp.

{
  ACE_TRACE ("ACE_Name_Reply::length");
  this->transfer_.length_ = l;
}

void ACE_Name_Reply::msg_type ( ACE_INT32  t  ) 

Definition at line 474 of file Name_Request_Reply.cpp.

{
  ACE_TRACE ("ACE_Name_Reply::msg_type");
  this->transfer_.type_ = t;
}

ACE_INT32 ACE_Name_Reply::msg_type ( void   )  const

Definition at line 467 of file Name_Request_Reply.cpp.

{
  ACE_TRACE ("ACE_Name_Reply::msg_type");
  return this->transfer_.type_;
}

ACE_INT32 ACE_Name_Reply::status ( void   )  const

Definition at line 483 of file Name_Request_Reply.cpp.

{
  ACE_TRACE ("ACE_Name_Reply::status");
  return this->transfer_.type_;
}

void ACE_Name_Reply::status ( ACE_INT32  s  ) 

Definition at line 492 of file Name_Request_Reply.cpp.

{
  ACE_TRACE ("ACE_Name_Reply::status");
  if (s == -1)
    this->transfer_.type_ = -1;
  else
    this->transfer_.type_ = 0;
}


Member Data Documentation

Transfer buffer.

Definition at line 258 of file Name_Request_Reply.h.


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