Messages


Messages are packets of information sent from one process to one or more other processes providing instructions or data for the receiving process. Messages are described in detail in the TIBCO SmartSockets User’s Guide.

The fields in a message can be traversed with the function TipcMsgTraverse. It uses a traversal function defined in this way:

typedef T_PTR (*T_IPC_MSG_TRAV_FUNC) 
  (T_IPC_MSG msg, T_IPC_MSG_TRAV field, T_PTR arg); 

For more information on traversal functions, see TIBCO SmartSockets Utilities. The specified traversal function for TipcMsgTraverse must be defined with these arguments. The second argument to the traversal function contains information for a field in a message. This is how the data structure for this argument is defined:

typedef struct T_IPC_MSG_TRAV_STRUCT T_IPC_MSG_TRAV_STRUCT,  
  *T_IPC_MSG_TRAV; 
struct T_IPC_MSG_TRAV_STRUCT { 
  T_INT2 *type_ptr; /* stored as 2 bytes in message */ 
  T_PTR value_ptr; /* can be cast to appropriate type */ 
  T_INT4 *array_size_ptr; /* NULL if not applicable */ 
  T_IPC_MSG_FIELD field; /* actual field */ 
}; 

The field type in a message is stored as a 2-byte integer (to save space), but should be referenced in code with the enumerated type T_IPC_FT. This is how T_IPC_FT is defined:

typedef enum { 
  T_IPC_FT_INVALID, 
  T_IPC_FT_CHAR, 
  T_IPC_FT_BINARY, 
  T_IPC_FT_STR, 
  T_IPC_FT_STR_ARRAY, 
  T_IPC_FT_INT2, 
  T_IPC_FT_INT2_ARRAY, 
  T_IPC_FT_INT4, 
  T_IPC_FT_INT4_ARRAY, 
  T_IPC_FT_INT8, 
  T_IPC_FT_INT8_ARRAY, 
  T_IPC_FT_REAL4, 
  T_IPC_FT_REAL4_ARRAY, 
  T_IPC_FT_REAL8, 
  T_IPC_FT_REAL8_ARRAY, 
  T_IPC_FT_REAL16, 
  T_IPC_FT_REAL16_ARRAY, 
  T_IPC_FT_MSG, 
  T_IPC_FT_MSG_ARRAY, 
  T_IPC_FT_INTERNAL_GROUP, /* used internally for message files */ 
  T_IPC_FT_INTERNAL_BOOL, /* used internally for message files */ 
  T_IPC_FT_INTERNAL_ID, /* used internally for message files */ 
  T_IPC_FT_INTERNAL_VERBOSE, /* used internally for message files */ 
  T_IPC_PROP_DELIVERY_MODE, /* access a property */ 
  T_IPC_PROP_DEST, /* access a property */ 
  T_IPC_PROP_PRIORITY, /* access a property */ 
  T_IPC_PROP_SENDER, /* access a property */ 
  T_IPC_PROP_TYPE, /* access a property */ 
  T_IPC_PROP_USER_PROP, /* access a property */ 
  T_IPC_PROP_DEST_SERVER, /* undocumented */ 
  T_IPC_PROP_SCOPE, /* undocumented */ 
  T_IPC_PROP_DELIVERY_TIMEOUT, /* access a property */ 
  T_IPC_PROP_LB_MODE, /* access a property */ 
  T_IPC_PROP_HEADER_STR_ENCODE /* access a property */ 
} T_IPC_FT; 

The T_IPC_PROP_* enumerated values are not field types, but instead allow a message property to be accessed with the convenience functions TipcMsgRead, TipcMsgReadVa, TipcMsgWrite, TipcMsgWriteVa, TipcConnMsgWrite, TipcConnMsgWriteVa, TipcSrvMsgWrite, and TipcSrvMsgWriteVa.

Both messages and message types (see Message Types on page 12) have a delivery mode property that controls what level of guarantee is used when a message is sent through a connection with TipcConnMsgSend. This is how the enumerated type used to identify this property is defined:

typedef enum { 
  T_IPC_DELIVERY_BEST_EFFORT, /* network failure can cause loss */ 
  T_IPC_DELIVERY_SOME,               /* guaranteed to deliver to at least one */ 
  T_IPC_DELIVERY_ALL,        /* guaranteed to deliver to all receivers */ 
  T_IPC_DELIVERY_ORDERED         /* despite failure, delivers in order published */ 
} T_IPC_DELIVERY_MODE; 

Both messages and message types (see Message Types on page 12) have a load balancing mode property that controls how a publish-subscribe message is load balanced. The enumerated type used to identify this property is defined as:

typedef enum { 
  T_IPC_LB_NONE, /* normal publish subscribe delivery mode */ 
  T_IPC_LB_ROUND_ROBIN, /* Round Robin load balancing */ 
  T_IPC_LB_WEIGHTED, /* weighted load balancing (based on GMD acks) */ 
  T_IPC_LB_SORTED /* sorted load balancing */ 
} T_IPC_LB_MODE; 

TIBCO SmartSockets™ Application Programming Interface
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com