HIPC  0.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
msgd.c File Reference
#include <hipc/msgd.h>
Include dependency graph for msgd.c:

Go to the source code of this file.

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...
 

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 hipcsvsLedRun(), hipcsvsRtRun(), hipcUsocWriteMsgd(), and test_hipcMsgdBdySize_hipcMsgdBdyPtr().

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.

Referenced by hipcsvsLedRun(), hipcsvsRtRun(), and test_hipcMsgdType().

Here is the caller graph for this function:

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.

Referenced by hipcsvsLedRun(), hipcsvsRtRun(), and test_hipcMsgdStruno().

Here is the caller graph for this function:

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.

Referenced by test_hipcMsgdOffset().

Here is the caller graph for this function:

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.

Referenced by test_hipcMsgdRngsize().

Here is the caller graph for this function:

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.

Referenced by test_hipcGenmdUnstru().

Here is the caller graph for this function:

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.

Referenced by hipcsvsLedRun(), hipcsvsRtRun(), and test_hipcGenmdSuccessToGet().

Here is the caller graph for this function:

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.

Referenced by hipcsvsLedRun(), hipcsvsRtRun(), and test_hipcMsgdSetBdyForPut().

Here is the caller graph for this function: