Codemesh Runtime v3 C++ API Reference  3.9.205
Public Types | Public Member Functions | Static Public Member Functions | List of all members
xmog_remote_message Class Reference

A class that provides services for creating message packages or decoding message packages. More...

#include <xmog_remote_message.h>

Public Types

enum  xmog_message_id {
  NONE = 0, SIGN_ON = 1, SIGN_ON_STATUS = 2, THREAD_ID_REQUEST = 3,
  THREAD_ID_ASSIGNMENT = 4, THREAD_TERMINATED = 5, SESSION_TERMINATED = 6, DROP_OBJECT_REFS = 7,
  CLASS_INFO_REQUEST = 11, CLASS_INFO_RESPONSE = 12, MEMBER_IDS_REQUEST = 13, MEMBER_IDS_ASSIGNMENT = 14,
  METHOD_CALL = 15, METHOD_RETURN = 16, GET_FIELD_REQUEST = 17, GET_FIELD_RESPONSE = 18,
  SET_FIELD_REQUEST = 19, SET_FIELD_RESPONSE = 20, CONSTRUCTOR_CALL = 21, CONSTRUCTOR_RETURN = 22
}
 The message types that are used in the framework.
 
enum  xmog_signon_status { STATUS_OK = 0, STATUS_NO_NEW_SESSIONS = 1, STATUS_NOT_AUTHORIZED = 2, STATUS_SHUTTING_DOWN = 3 }
 The signon request reply codes used by the server.
 

Public Member Functions

 xmog_remote_message (size_t size=512)
 
int get_iovecs (iovec *vec)
 Returns the number of entries in the iovec[]. More...
 
void * body () const
 Returns the message body. More...
 
void prependLength ()
 Prepends the message length to the message.
 
void writeBoolean (bool b)
 Appends a bool to the message.
 
bool readBoolean ()
 Reads a bool from the message.
 
void writeByte (jbyte b)
 Appends a byte to the message.
 
jbyte readByte ()
 Reads a byte from the message.
 
void writeChar (jchar c)
 Appends a jchar to the message.
 
jchar readChar ()
 Reads a jchar from the message.
 
void writeDouble (jdouble d)
 Appends a jdouble to the message.
 
jdouble readDouble ()
 Reads a jdouble from the message.
 
void writeFloat (jfloat d)
 Appends a jfloat to the message.
 
jfloat readFloat ()
 Reads a jfloat from the message.
 
void writeInt (jint i)
 Appends a 32bit integer to the message. More...
 
jint readInt ()
 Reads a 32bit integer from the message. More...
 
void writeShort (jshort s)
 Appends a 16bit integer to the message. More...
 
jshort readShort ()
 Reads a 16bit integer from the message. More...
 
void writeString (const char *str, size_t len=(size_t) -1)
 Appends a platform string to the message. More...
 
void writeString (const XMOG_WCHAR *str, size_t len=(size_t) -1)
 Appends a wide string to the message. More...
 
void writeUTF (const char *utf, size_t len=(size_t) -1)
 Appends a UTF string to the message. More...
 
int getMessageCode (int &code)
 Retrieves the message code.
 
int getSignOnReplyCode (int &code)
 Retrieves the sign-on reply code.
 
void dump ()
 

Static Public Member Functions

static xmog_remote_messagecreateSignOnMessage (const char *serverAppNameUTF, const char *clientDisplayNameUTF=NULL, bool alignDataForClient=true, const char *clientSignOnNameUTF=NULL, const char *clientCredentialsUTF=NULL, int authenticationType=0)
 Returns a dynamically allocated, fully initialized message object that can be used to sign on to the server. More...
 
static xmog_remote_messagecreateSignOffMessage ()
 Returns a dynamically allocated, fully initialized message object that can be used to sign off the server.
 
static xmog_remote_messagecreateMemberIDsRequestMessage (xmog_java_class *_clazz)
 Returns a dynamically allocates, fully initialized message object that can be used to query the member ids. More...
 
static xmog_remote_messagecreateMessage (void *body)
 Returns a message that represents a server's reply to a client request. More...
 

Detailed Description

A class that provides services for creating message packages or decoding message packages.

Member Function Documentation

◆ body()

void* xmog_remote_message::body ( ) const

Returns the message body.

The message body is an opaque handle to the message content. It is currently implemented as an ACE_Message_Block pointer, but that is an implementation detail that shouldn't be relied upon by a user.

◆ createMemberIDsRequestMessage()

static xmog_remote_message* xmog_remote_message::createMemberIDsRequestMessage ( xmog_java_class _clazz)
static

Returns a dynamically allocates, fully initialized message object that can be used to query the member ids.

Parameters
_clazzthe proxy type for which we're asking for an ID and member IDs.

◆ createMessage()

static xmog_remote_message* xmog_remote_message::createMessage ( void *  body)
static

Returns a message that represents a server's reply to a client request.

Parameters
themessage body as an ACE_Message_Block pointer.

◆ createSignOnMessage()

static xmog_remote_message* xmog_remote_message::createSignOnMessage ( const char *  serverAppNameUTF,
const char *  clientDisplayNameUTF = NULL,
bool  alignDataForClient = true,
const char *  clientSignOnNameUTF = NULL,
const char *  clientCredentialsUTF = NULL,
int  authenticationType = 0 
)
static

Returns a dynamically allocated, fully initialized message object that can be used to sign on to the server.

Parameters
serverAppNameUTFThe server can host more than one logical application, each of which is identified by a unique name. A logical application maps to a directory in the server's application root directory. This directory contains all information necessary to initialize the the application. If NULL or the empty string is used here, a default application is used.
clientDisplayNameUTFThe name under which the session is known on the server. This name is mostly useful for debugging and identifying a particular session in the server monitoring console.
alignDataForClientA flag governing whether message data should be aligned or not.
clientSignOnNameUTFThe username for autenticated login.
clientCredentialsUTFThe credentials used for authenticated login.
authenticationTypeAn index used to select an authentication mechanism.

◆ get_iovecs()

int xmog_remote_message::get_iovecs ( iovec *  vec)

Returns the number of entries in the iovec[].

Parameters
vecthe iovec that will be filled with the message contents.

◆ readInt()

jint xmog_remote_message::readInt ( )

Reads a 32bit integer from the message.

This method converts the number from network to host order.

◆ readShort()

jshort xmog_remote_message::readShort ( )

Reads a 16bit integer from the message.

This method converts the number from network to host order.

◆ writeInt()

void xmog_remote_message::writeInt ( jint  i)

Appends a 32bit integer to the message.

This method converts the number from host to network order.

◆ writeShort()

void xmog_remote_message::writeShort ( jshort  s)

Appends a 16bit integer to the message.

This method converts the number from host to network order.

◆ writeString() [1/2]

void xmog_remote_message::writeString ( const char *  str,
size_t  len = (size_t) -1 
)

Appends a platform string to the message.

This method converts the platform string to UTF before appending it to the message.

Parameters
stra string in platform encoding.
lenthe optional number of characters to encode. The default is -1, which stands for all characters.

◆ writeString() [2/2]

void xmog_remote_message::writeString ( const XMOG_WCHAR *  str,
size_t  len = (size_t) -1 
)

Appends a wide string to the message.

This method converts the wide string to UTF before appending it to the message.

Parameters
stra string in platform encoding.
lenthe optional number of characters to encode. The default is -1, which stands for all characters. Notice that the argument is the number of characters, not the number of bytes.

◆ writeUTF()

void xmog_remote_message::writeUTF ( const char *  utf,
size_t  len = (size_t) -1 
)

Appends a UTF string to the message.

Parameters
stra string in UTF encoding. In many cases, developers can directly use this method, which is much faster than the corresponding writeString() methods because no conversion has to be performed.
lenthe optional number of characters to encode. The default is -1, which stands for all characters.

The documentation for this class was generated from the following file:

Copyright (c) 1999-2020 by Codemesh, Inc., ALL RIGHTS RESERVED.