HIPC  0.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Data Structures | Macros | Typedefs | Functions
msgd.h File Reference
#include <stddef.h>
#include <hipc.h>
Include dependency graph for msgd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  HIPC_msgdata
 

Macros

#define hipcGenmdQuit(md_p, hipc_errno, errdtlstr)   hipcGenmdUnstru((md_p), HIPC_MESSAGE_TYPE_QUIT, (hipc_errno), (errdtlstr), sizeof(errdtlstr))
 Initializes a HIPC message data as a QUIT message. More...
 
#define hipcGenmdSuccess(md_p)   hipcGenmdUnstru((md_p), HIPC_MESSAGE_TYPE_SUCCESS, HIPC_SUCCESS, 0, 0)
 Initializes a HIPC message data as a SUCCESS message. More...
 
#define hipcMsgdHdrPtr(md_p)   ((md_p)->header)
 Returns a pointer to a header of a HIPC message data. More...
 
#define hipcMsgdBdyPtr(md_p)   ((md_p)->body_p)
 Returns a pointer to a body of a HIPC message data. More...
 

Typedefs

typedef struct HIPC_msgdata hipc_msgd
 

Functions

unsigned char hipcMsgdBdySize (hipc_msgd const *const md_p)
 Returns body size of a HIPC message data. More...
 
unsigned char hipcMsgdType (hipc_msgd const *const md_p)
 Returns type of a HIPC message data. More...
 
unsigned char hipcMsgdStruno (hipc_msgd const *const md_p)
 Returns structure number of a HIPC message data. More...
 
unsigned char hipcMsgdOffset (hipc_msgd const *const md_p)
 Returns offset of a HIPC message data. More...
 
unsigned char hipcMsgdRngsize (hipc_msgd const *const md_p)
 Returns range size of a HIPC message data. More...
 
enum HIPC_errno hipcGenmdUnstru (hipc_msgd *const md_p, const unsigned char type, const enum HIPC_errno hipc_errno, char *const errdtlstr, size_t errdtlstr_size)
 Initializes a HIPC message data as a unstructured type message. More...
 
enum HIPC_errno hipcGenmdSuccessToGet (hipc_msgd *const mds_p, hipc_msgd const *const mdr_p, void *const stru_p, const size_t stru_size)
 Initializes mds_p as a response to mdr_p whose type must be GET. More...
 
enum HIPC_errno hipcMsgdSetBdyForPut (hipc_msgd *const mdr_p, void *const stru_p, const size_t stru_size)
 Sets a body to a HIPC message data that contains a header of a PUT message. More...
 

Macro Definition Documentation

#define hipcGenmdQuit (   md_p,
  hipc_errno,
  errdtlstr 
)    hipcGenmdUnstru((md_p), HIPC_MESSAGE_TYPE_QUIT, (hipc_errno), (errdtlstr), sizeof(errdtlstr))

Initializes a HIPC message data as a QUIT message.

errdtlstr must have both an address and a size of the string, so errdtlstr must be a string literal or a variable whose type is array of char. errdtlstr must not be a simple pointer to char because sizeof(char *) equals a constant value.

Parameters
md_ppointer to a HIPC message data
hipc_errnoHIPC error number
errdtlstrerror detail string
Returns
the same value as hipc_errno.

Definition at line 26 of file msgd.h.

#define hipcGenmdSuccess (   md_p)    hipcGenmdUnstru((md_p), HIPC_MESSAGE_TYPE_SUCCESS, HIPC_SUCCESS, 0, 0)

Initializes a HIPC message data as a SUCCESS message.

Parameters
md_ppointer to a HIPC message data
Returns
HIPC_SUCCESS.

Definition at line 35 of file msgd.h.

#define hipcMsgdHdrPtr (   md_p)    ((md_p)->header)

Returns a pointer to a header of a HIPC message data.

Parameters
md_ppointer to a HIPC message data
Returns
pointer to the header of the HIPC message data.

Definition at line 44 of file msgd.h.

Referenced by hipcUsocWriteMsgd().

#define hipcMsgdBdyPtr (   md_p)    ((md_p)->body_p)

Returns a pointer to a body of a HIPC message data.

Parameters
md_ppointer to a HIPC message data
Returns
pointer to the body of the HIPC message data.

Definition at line 52 of file msgd.h.

Referenced by hipcUsocWriteMsgd().

Typedef Documentation

typedef struct HIPC_msgdata hipc_msgd

Function Documentation

unsigned char hipcMsgdBdySize ( hipc_msgd const *const  md_p)

Returns body size of a HIPC message data.

Parameters
md_ppointer to a HIPC message data
Returns
body size of the HIPC message data

Definition at line 9 of file msgd.c.

References HIPC_msgdata::header, and hipcMsghdrBdysize().

Referenced by hipcUsocWriteMsgd().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned char hipcMsgdType ( hipc_msgd const *const  md_p)

Returns type of a HIPC message data.

Parameters
md_ppointer to a HIPC message data
Returns
type of the HIPC message data

Definition at line 20 of file msgd.c.

References HIPC_msgdata::header, and HIPC_MSGHDR_BYTE_TYPE.

unsigned char hipcMsgdStruno ( hipc_msgd const *const  md_p)

Returns structure number of a HIPC message data.

Parameters
md_ppointer to a HIPC message data
Returns
structure number of the HIPC message data

Definition at line 31 of file msgd.c.

References HIPC_msgdata::header, and HIPC_MSGHDR_BYTE_STRUNO.

unsigned char hipcMsgdOffset ( hipc_msgd const *const  md_p)

Returns offset of a HIPC message data.

Parameters
md_ppointer to a HIPC message data
Returns
offset of the HIPC message data

Definition at line 42 of file msgd.c.

References HIPC_msgdata::header, and HIPC_MSGHDR_BYTE_OFFSET.

unsigned char hipcMsgdRngsize ( hipc_msgd const *const  md_p)

Returns range size of a HIPC message data.

Parameters
md_ppointer to a HIPC message data
Returns
range size of the HIPC message data

Definition at line 53 of file msgd.c.

References HIPC_msgdata::header, and HIPC_MSGHDR_BYTE_BDYSZ.

enum HIPC_errno hipcGenmdUnstru ( hipc_msgd *const  md_p,
const unsigned char  type,
const enum HIPC_errno  hipc_errno,
char *const  errdtlstr,
size_t  errdtlstr_size 
)

Initializes a HIPC message data as a unstructured type message.

Parameters
md_ppointer to a HIPC message data
typemessage type
hipc_errnoHIPC error number
errdtlstrerror detail string
errdtlstr_sizesize of the error detail string
Returns
the same value as hipc_errno.

Definition at line 68 of file msgd.c.

References HIPC_msgdata::body_p, HIPC_msgdata::header, HIPC_MSGHDR_BYTE_BDYSZ, HIPC_MSGHDR_BYTE_OFFSET, HIPC_MSGHDR_BYTE_STRUNO, HIPC_MSGHDR_BYTE_TYPE, and HIPC_UNSTRU.

enum HIPC_errno hipcGenmdSuccessToGet ( hipc_msgd *const  mds_p,
hipc_msgd const *const  mdr_p,
void *const  stru_p,
const size_t  stru_size 
)

Initializes mds_p as a response to mdr_p whose type must be GET.

stru_p should be the beginning of a structure specified by the GET message.

Parameters
mds_ppointer to a HIPC message data to be sent
mdr_ppointer to a HIPC message data received
stru_ppointer to a structure object
stru_sizesize of the structure object
Returns
HIPC_SUCCESS on success, or an error on failure.

Definition at line 102 of file msgd.c.

References HIPC_msgdata::body_p, HIPC_msgdata::header, HIPC_ERR_S_INV_RW_RANGE, HIPC_MESSAGE_TYPE_SUCCESS, HIPC_MSGHDR_BYTE_BDYSZ, HIPC_MSGHDR_BYTE_OFFSET, HIPC_MSGHDR_BYTE_STRUNO, HIPC_MSGHDR_BYTE_TYPE, and HIPC_SUCCESS.

enum HIPC_errno hipcMsgdSetBdyForPut ( hipc_msgd *const  mdr_p,
void *const  stru_p,
const size_t  stru_size 
)

Sets a body to a HIPC message data that contains a header of a PUT message.

The body will be a part of stru_p. stru_p should be the beginning of a structure which is specified by the header of md_p so that the following statement reads the body of the PUT message into correct place.

hipcUsocRead(so_p, hipcMsgdBdyPtr(md_p), hipcMsgdBdySize(md_p));

Parameters
mdr_ppointer to a HIPC message data
stru_ppointer to a structure object
stru_sizesize of the structure object
Returns
HIPC_SUCCESS on success, or an error on failure.

Definition at line 140 of file msgd.c.

References HIPC_msgdata::body_p, HIPC_msgdata::header, HIPC_ERR_S_INV_RW_RANGE, HIPC_MSGHDR_BYTE_BDYSZ, HIPC_MSGHDR_BYTE_OFFSET, and HIPC_SUCCESS.