HIPC  0.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
msgd.h
Go to the documentation of this file.
1 #ifndef HIPC_MSGD_H
2 #define HIPC_MSGD_H
3 
4 #include <stddef.h>
5 
6 #include <hipc.h>
7 
8 typedef struct HIPC_msgdata {
9  unsigned char header[HIPC_MSGHDR_SIZE];
10  void *body_p;
11 } hipc_msgd;
12 
26 #define hipcGenmdQuit(md_p, hipc_errno, errdtlstr) \
27  hipcGenmdUnstru((md_p), HIPC_MESSAGE_TYPE_QUIT, (hipc_errno), (errdtlstr), sizeof(errdtlstr))
28 
35 #define hipcGenmdSuccess(md_p) \
36  hipcGenmdUnstru((md_p), HIPC_MESSAGE_TYPE_SUCCESS, HIPC_SUCCESS, 0, 0)
37 
44 #define hipcMsgdHdrPtr(md_p) ((md_p)->header)
45 
52 #define hipcMsgdBdyPtr(md_p) ((md_p)->body_p)
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58  extern unsigned char hipcMsgdBdySize(hipc_msgd const *const md_p);
59  extern unsigned char hipcMsgdType(hipc_msgd const *const md_p);
60  extern unsigned char hipcMsgdStruno(hipc_msgd const *const md_p);
61  extern unsigned char hipcMsgdOffset(hipc_msgd const *const md_p);
62  extern unsigned char hipcMsgdRngsize(hipc_msgd const *const md_p);
63  extern enum HIPC_errno
64  hipcGenmdUnstru(hipc_msgd * const md_p,
65  const unsigned char type,
66  const enum HIPC_errno hipc_errno,
67  char *const errdtlstr, size_t errdtlstr_size);
68  extern enum HIPC_errno
69  hipcGenmdSuccessToGet(hipc_msgd * const mds_p,
70  hipc_msgd const *const mdr_p,
71  void *const stru_p, const size_t stru_size);
72  extern enum HIPC_errno
73  hipcMsgdSetBdyForPut(hipc_msgd * const mdr_p,
74  void *const stru_p, const size_t stru_size);
75 
76 #ifdef __cplusplus
77 }
78 #endif
79 #endif
unsigned char header[HIPC_MSGHDR_SIZE]
Definition: msgd.h:9
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.
Definition: msgd.c:102
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.
Definition: msgd.c:68
HIPC_errno
Definition: hipc.h:4
unsigned char hipcMsgdStruno(hipc_msgd const *const md_p)
Returns structure number of a HIPC message data.
Definition: msgd.c:31
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.
Definition: msgd.c:140
unsigned char hipcMsgdBdySize(hipc_msgd const *const md_p)
Returns body size of a HIPC message data.
Definition: msgd.c:9
unsigned char hipcMsgdOffset(hipc_msgd const *const md_p)
Returns offset of a HIPC message data.
Definition: msgd.c:42
void * body_p
Definition: msgd.h:10
unsigned char hipcMsgdType(hipc_msgd const *const md_p)
Returns type of a HIPC message data.
Definition: msgd.c:20
unsigned char hipcMsgdRngsize(hipc_msgd const *const md_p)
Returns range size of a HIPC message data.
Definition: msgd.c:53
struct HIPC_msgdata hipc_msgd