11     "HIPC_SUCCESS: No error",
 
   13     "HIPC_ERR_S_INV_UDATA: Invalid user data",
 
   14     "HIPC_ERR_S_INV_MSG_TYPE: Invalid message type",
 
   15     "HIPC_ERR_S_INV_STRUNO: Invalid structure number",
 
   16     "HIPC_ERR_S_INV_RW_RANGE: Invalid read/write range",
 
   17     "HIPC_ERR_S_V_UNINIT_MSG: Virtually uninitialized HIPC message",
 
   18     "HIPC_ERR_S_IO_READ: I/O read error",
 
   19     "HIPC_ERR_S_IO_WRITE: I/O write error",
 
   20     "HIPC_ERR_S_INV_CFG: Invalid Configuration",
 
   21     "HIPC_ERR_S_INV_NULL: Invalid NULL value",
 
   22     "HIPC_ERR_S_BUF_SHTG: Buffer shortage",
 
   23     "HIPC_ERR_S_OVERSIZED_STRU: Oversized structure size",
 
   24     "HIPC_ERR_S_PBANK_STAT_MISMATCH: pbank status mismatch",
 
   26     "HIPC_ERR_C_STD: C standard library error",
 
   27     "HIPC_ERR_INTERNAL_ERROR: Internal error in HIPC library",
 
   28     "HIPC_ERR_IO_READ: I/O read error",
 
   29     "HIPC_ERR_IO_WRITE: I/O write error",
 
   30     "HIPC_ERR_PROTOCOL_VIOLATION: Protocol violation",
 
   31     "HIPC_ERR_INV_ENDIAN: Invalid endian",
 
   32     "HIPC_ERR_INV_ID_STR: Invalid ID string",
 
   33     "HIPC_ERR_INV_BASE_CLIENT: Invalid base client",
 
   34     "HIPC_ERR_MBR_SIZE_MISMATCH: Structure member size mismatch",
 
   35     "HIPC_ERR_SESS_STATE_MISMATCH: Session state mismatch",
 
   37     "HIPC_ERR_FOR_TESTING: Error only for testing",
 
   38     "HIPC_ERR_TEST_LIB_INTERNAL: Internal error in a library only for testing",
 
   49 static void *hipcClientMalloc(
struct HIPC_client *
const cl_p, 
size_t size)
 
   62     if (NULL == pllist_p) {
 
   68     pllist_p->
ptr = tmp_p;
 
   84 static void *hipcClientCalloc(
struct HIPC_client *
const cl_p, 
size_t nmemb,
 
   90     tmp_p = calloc(nmemb, size);
 
   98     if (NULL == pllist_p) {
 
  104     pllist_p->
ptr = tmp_p;
 
  160         return "Unknown HIPC errorno value";
 
  196 hipcClientSetErrDtlStr(
struct HIPC_client *
const cl_p,
 
  197                        char const *
const str0,
 
  198                        char const *
const str1, 
size_t ls1)
 
  242                                    char const *
const str)
 
  245     hipcClientSetErrDtlStr(cl_p, str, NULL, 0);
 
  261                   const unsigned char struno, 
void *cimg_p)
 
  264     cl_p->
cimg_pp[struno] = cimg_p;
 
  280                      const unsigned char struno,
 
  283                                                  void *), 
void *
const arg)
 
  304                       const unsigned char struno, 
const hipc_msg msgR)
 
  312     if (NULL != cl_p->
hndlr_pp[struno]) {
 
  345     if (NULL == clbase_p) {
 
  358     if (NULL == cl_p->
indp_p) {
 
  360                                   "cl_p->indp_p is NULL");
 
  362     if (NULL == cl_p->
cmdp_p) {
 
  364                                   "cl_p->cmdp_p is NULL");
 
  369                                   "cl_p->cmdp_p->endian is 'o'");
 
  373         hipcClientCalloc(cl_p,
 
  387         hipcClientCalloc(cl_p,
 
  401     if (NULL == clbase_p->
smdp_p) {
 
  403             hipcClientCalloc(cl_p, 1, 
sizeof(
struct HIPC_cl_dp));
 
  404         if (NULL == cl_p->
smdp_p) {
 
  468         for (i = 0; i < mis_p->
n_member; ++i) {
 
  476                             "MBR_SIZE_MISMATCH: " 
  478                             "struno/mbrnum %d/%d; " 
  479                             "client-side size/server-side size %d/%d\n",
 
  486                     hipcClientSetErrDtlStr(cl_p,
 
  487                                            "The member size in server is not the same as the size in client; member name: ",
 
  510                        const unsigned char struno,
 
  511                        const size_t offset, 
const size_t rngsize)
 
  516                 "INV_STRUNO: (struno=)%d >= %d(=cl_p->indp_p->n_struct)\n",
 
  521                                   "INV_STRUNO: The structure number is equal to or more than cl_p->indp_p->n_struct");
 
  526                 "INV_OFFSET: (offset=)%ld >= %d(=cl_p->smdp_p->struct_size_p[struno])\n",
 
  530                                   "INV_OFFSET: The offest value is equal to or more than cl_p->smdp_p->struct_size_p[struno]");
 
  535                 "INV_SIZE: (rngsize=)%ld > %d(=cl_p->smdp_p->struct_size_p[struno])\n",
 
  539                                   "INV_RNGSIZE: The rngsize is more than cl_p->smdp_p->struct_size_p[struno]");
 
  544                 "INV_OFFSET_RNGSIZE: (offset=)%ld+(rngsize=)%ld > %d(=ccl_p->smdp_p->struct_size_p[struno])\n",
 
  548                                   "INV_OFFSET_SIZE: The sum of offset and rngsizeis is more than cl_p->smdp_p->struct_size_p[struno]");
 
  567                const *
const mbr_p, 
size_t * offset_p, 
size_t * size_p)
 
  570     unsigned long ary_idx;
 
  578     switch (mbr_p->
type) {
 
  580         hipcClientSetErrDtlStr(cl_p, 
"Inappropriate string: ", str, 0);
 
  586             hipcClientSetErrDtlStr(cl_p,
 
  587                                    "No period before the member name: ",
 
  593         n = strcspn(str + 1, 
".[");
 
  599                 hipcClientSetErrDtlStr(cl_p, 
"Unknown member name: ",
 
  604             if (0 == strncmp(str + 1, indstc_p->
mbr_p[i].
name, n)) {
 
  610         *size_p = rmdstc_p->
size_p[i];
 
  611         if (
'\0' == str[n + 1]) {
 
  616             GetStrutpl_mbr(cl_p, &str[n + 1], &indstc_p->
mbr_p[i],
 
  624             hipcClientSetErrDtlStr(cl_p,
 
  625                                    "No left bracket following the array name: ",
 
  630         ary_idx = strtoul(&str[1], &end_p, 10);
 
  631         if (ULONG_MAX == ary_idx || &str[1] == end_p) {
 
  632             hipcClientSetErrDtlStr(cl_p,
 
  633                                    "Failed to extract index from: ",
 
  639             hipcClientSetErrDtlStr(cl_p,
 
  640                                    "No right bracket following the index number: ",
 
  648                                       "Number of dimensions is zero: mbr_p->ary_dim is zero");
 
  651             hipcClientSetErrDtlStr(cl_p,
 
  652                                    "The index is out of range: ", str, 0);
 
  658         *offset_p += (*size_p) * ary_idx;
 
  659         if (
'\0' == *(end_p + 1)) {
 
  672             GetStrutpl_mbr(cl_p, &str[(end_p - str) + 1], &nxtmbr,
 
  680                                   "Invalid member type: invalid value in mbr_p->type");
 
  699                      char const *
const str,
 
  700                      unsigned char *struno_p,
 
  701                      size_t * offset_p, 
size_t * size_p)
 
  708     n = strcspn(str, 
".");
 
  712             hipcClientSetErrDtlStr(cl_p, 
"Unknown structure name: ",
 
  723     if (
'\0' == str[n]) {
 
  731         retval = GetStrutpl_mbr(cl_p, str + n, &mbr, offset_p, size_p);
 
  759                   unsigned char *
const begin, 
unsigned char *
const end,
 
  760                   unsigned char *
const scur_p, 
unsigned char *
const ccur_p,
 
  761                   const size_t ssize, 
const size_t csize,
 
  762                   void (*fnc_p) (
void *
const ccur_p, 
void *
const scur_p,
 
  770     unsigned char *stmp_p;
 
  771     unsigned char *ctmp_p;
 
  776     switch (mbr_p->
type) {
 
  778         if ((begin <= scur_p) && (end >= scur_p + ssize)) {
 
  779             fnc_p(scur_p, ccur_p, ssize);
 
  786         for (i = 0; i < indstc_p->
n_member; ++i) {
 
  787             if (end <= scur_p + rmdstc_p->offset_p[i]) {
 
  790             if ((end > scur_p + rmdstc_p->
offset_p[i]) &&
 
  799                                       lmdstc_p->
size_p[i], fnc_p);
 
  809         for (i = 0; i < mbr_p->
ary_dim; ++i) {
 
  813         if (0 == celm_size) {
 
  815                                       "ZERO_SIZE: celm_size is zero");
 
  817         if (0 == selm_size) {
 
  819                                       "ZERO_SIZE: selm_size is zero");
 
  824         if (begin <= scur_p) {
 
  828             stmp_p = begin - ((begin - scur_p) % selm_size);
 
  830                 ccur_p + (((stmp_p - scur_p) / selm_size) * celm_size);
 
  832         while (end > stmp_p && scur_p + ssize > stmp_p) {
 
  834                                        stmp_p, ctmp_p, selm_size,
 
  845                                   "Invalid member type: invalid value in mbr_p->type");
 
  852 static void memcpy_wrapper(
void *
const scur_p, 
void *
const ccur_p,
 
  855     memcpy(scur_p, ccur_p, n);
 
  859 static void contra_memcpy(
void *
const scur_p, 
void *
const ccur_p,
 
  862     memcpy(ccur_p, scur_p, n);
 
  866 static void convert_endian(
void *
const scur_p, 
void *
const ccur_p,
 
  871     for (i = 0; i < n; ++i) {
 
  872         ((
unsigned char *) scur_p)[i] =
 
  873             ((
unsigned char *) ccur_p)[n - 1 - i];
 
  879 static void contra_convert_endian(
void *
const scur_p, 
void *
const ccur_p,
 
  884     for (i = 0; i < n; ++i) {
 
  885         ((
unsigned char *) ccur_p)[i] =
 
  886             ((
unsigned char *) scur_p)[n - 1 - i];
 
  909                  const unsigned char struno, 
const size_t offset,
 
  910                  const size_t size, 
void *simg, 
void *cimg)
 
  913     void (*fnc_p) (
void *
const ccur_p, 
void *
const scur_p, 
const size_t n);
 
  922         if (NULL == cl_p->
cimg_pp[struno]) {
 
  936         fnc_p = contra_memcpy;
 
  938         fnc_p = contra_convert_endian;
 
  941                              (
unsigned char *) simg + offset,
 
  942                              (
unsigned char *) simg + offset + size,
 
  943                              simg, cimg, 0, 0, fnc_p);
 
  963                const unsigned char struno,
 
  964                const size_t offset, 
const size_t size,
 
  965                void *simg, 
void *cimg)
 
  968     void (*fnc_p) (
void *
const scur_p, 
void *
const ccur_p, 
const size_t n);
 
  977         if (NULL == cl_p->
cimg_pp[struno]) {
 
  991         fnc_p = memcpy_wrapper;
 
  993         fnc_p = convert_endian;
 
  996                              (
unsigned char *) simg + offset,
 
  997                              (
unsigned char *) simg + offset + size,
 
  998                              simg, cimg, 0, 0, fnc_p);
 
 1017                                   "INVALID_MSGBDY_TYPE: A message fed to hipcClientFeedUnstrumsgAsError() must have an unstructured body");
 
 1038 FeedSysmsg_OFFSET_SIZE(
struct HIPC_client *
const cl_p,
 
 1039                        const hipc_msg msg, 
unsigned char **
const tgtadr)
 
 1048                 "INV_STRUNO: (cl_p->indp_p->n_struct=)%d <= %d(=struno)\n",
 
 1052                                   "INV_STRUNO: The structure number in the system message is over cl_p->indp_p->n_struct");
 
 1058                 "INV_N_MEMBER: (cl_p->indp_p->struct_p[struno].n_member=)%d != %d(=bdysz)\n",
 
 1062                                   "INV_N_MEMBER: The number of members in the system message is not same as the number in cl_p");
 
 1065     tmp_p = hipcClientMalloc(cl_p, bdysz);
 
 1066     if (NULL == tmp_p) {
 
 1070     if (NULL != *tgtadr) {
 
 1072                                   "INVALID_SYSMSG: The information has been already set in cl_p");
 
 1092     unsigned char **tgtadr;
 
 1099                                   "INVALID_MSG_TYPE: Type must be SYS or QUIT");
 
 1108                                       "cl_p->smdp_p->endian is not 'B' nor 'l'");
 
 1119                     "UNMATCHED_SYSMSG: (cl_p->indp_p->n_struct=)%d != %d(=bdysz)\n",
 
 1123                                       "UNMATCHED_SYSMSG: cl_p->indp_p->n_struct is not the same as the number in the system message");
 
 1126             hipcClientMalloc(cl_p,
 
 1127                              sizeof(
unsigned char) *
 
 1129         if (NULL == tmp_p) {
 
 1136             if (NULL == tmp_p) {
 
 1144         retval = FeedSysmsg_OFFSET_SIZE(cl_p, msgR, tgtadr);
 
 1151         retval = FeedSysmsg_OFFSET_SIZE(cl_p, msgR, tgtadr);
 
 1158                                   "Invalid system message");
 
 1185     if (0 != msgR[HIPC_MSGHDR_BYTE_BDYSZ]) {
 
 1186         memcpy(cl_p->
simg_pp[msgR[HIPC_MSGHDR_BYTE_STRUNO]] +
 
 1187                msgR[HIPC_MSGHDR_BYTE_OFFSET],
 
 1224               const unsigned char struno,
 
 1225               const size_t offset, 
const size_t size)
 
 1254               const unsigned char struno,
 
 1255               const size_t offset, 
const size_t size)
 
enum HIPC_errno hipcClientInit(struct HIPC_client *const cl_p, struct HIPC_client const *const clbase_p)
Initializes a HIPC client with allocating memory space if necessary. 
Machine-dependent information of a structure used in a client. 
void hipcClientSetStdErrno(struct HIPC_client *const cl_p)
Sets errno value to a HIPC client. 
unsigned char hipc_msg[HIPC_MSG_ALLOCSIZE]
void hipcGenmsgHello(hipc_msg msg, const struct HIPC_client *const cl_p)
Generates HELLO message. 
enum HIPC_errno hipcClientFeedSysmsg(struct HIPC_client *const cl_p, const hipc_msg msgR)
Feeds a system message and incorporates it to the internal data of the client. 
enum HIPC_errno hipcClientCallHandler(struct HIPC_client *const cl_p, const unsigned char struno, const hipc_msg msgR)
Calls a handler that corresponds to struno. 
Machine-independent information of a member of a structure used in a client. 
enum HIPC_errno hipcClientCheckMbrSize(struct HIPC_client *const cl_p)
Checks whether sizes of members in structures in a server are the same as sizes in a client...
void ** hdarg_pp
Handler's arguments. 
enum HIPC_errno hipcClientGetStrutpl(struct HIPC_client *const cl_p, char const *const str, unsigned char *struno_p, size_t *offset_p, size_t *size_p)
Gets structure number, offset, and size from ID string. 
#define HIPC_IMG_ALLOCSIZE
struct HIPC_cl_dp * cmdp_p
Client Machine DePendent data. 
char err_detail_str[HIPC_IMG_ALLOCSIZE]
enum HIPC_errno hipcGenmsgPut(hipc_msg msg, struct HIPC_client *const cl_p, const unsigned char struno, const size_t offset, const size_t size)
Generates PUT message. 
int hipcClientGetStdErrno(const struct HIPC_client *const cl_p)
Gets an errno value saved by hipcClientSetStdErrno(). 
void hipcGenmsgBye(hipc_msg msg)
Initializes a HIPC message as a BYE message. 
size_t const * ary_max_idxs
Machine-independent information of a structure used in a client. 
void hipcClientSetHandler(struct HIPC_client *const cl_p, const unsigned char struno, enum HIPC_errno(*hndlr_p)(struct HIPC_client *, const hipc_msg, void *, void *), void *const arg)
Sets an handler hndlr_p to a structure number struno. 
enum HIPC_errno hipcClientFeedStrumsg(struct HIPC_client *const cl_p, const hipc_msg msgR)
Feeds a message and incorporates it to the internal data of a client. 
enum HIPC_errno hipcClientSetError(struct HIPC_client *const cl_p, enum HIPC_errno hipc_errno, char const *const str)
Sets an error to a client with error detail. 
struct HIPC_ptr_link_list * pllist_p
struct HIPC_cl_indp_mbr const * mbr_p
enum HIPC_errno hipcGenmsgGet(hipc_msg msg, struct HIPC_client *const cl_p, const unsigned char struno, const size_t offset, const size_t size)
Generates GET message. 
enum HIPC_errno hipcClientUnpack(struct HIPC_client *const cl_p, const unsigned char struno, const size_t offset, const size_t size, void *simg, void *cimg)
Unpacks a range of contents of simg into cimg. 
enum HIPC_errno(** hndlr_pp)(struct HIPC_client *, const hipc_msg, void *, void *)
void hipcClientSetCimg(struct HIPC_client *const cl_p, const unsigned char struno, void *cimg_p)
Sets a client-side image that is a structure instance of a structure. 
enum HIPC_member_type elm_type
enum HIPC_errno hipcClientEachMbr(struct HIPC_client *const cl_p, struct HIPC_cl_indp_mbr const *const mbr_p, unsigned char *const begin, unsigned char *const end, unsigned char *const scur_p, unsigned char *const ccur_p, const size_t ssize, const size_t csize, void(*fnc_p)(void *const ccur_p, void *const scur_p, const size_t n))
Calls the function specified by fnc_p with each member between begin and end. 
enum HIPC_errno hipcClientCheckStrutpl(struct HIPC_client *const cl_p, const unsigned char struno, const size_t offset, const size_t rngsize)
Checks a combination of a structure number, an offset, and a size for a HIPC message. 
enum HIPC_member_type type
unsigned char const * struct_size_p
struct HIPC_cl_indp_stru const * struct_p
enum HIPC_errno hipc_errno
const char * hipcClientGetErrStr(const struct HIPC_client *const cl_p)
Gets a string describing a HIPC error number that has been set to a HIPC client. 
unsigned char hipcClientGetNsysmsg(struct HIPC_client const *const cl_p)
Gets the number of system messages. 
const unsigned char * cfgid
enum HIPC_errno hipcClientPack(struct HIPC_client *const cl_p, const unsigned char struno, const size_t offset, const size_t size, void *simg, void *cimg)
Packs a range of contents of cimg into simg. 
unsigned char ** simg_pp
Server-side images of structures. 
enum HIPC_errno hipcClientFeedUnstrumsgAsError(struct HIPC_client *const cl_p, const hipc_msg msgR)
Feeds a message and sets an error specified by the message. 
void hipcClientTerminate(struct HIPC_client *const cl_p)
Terminates a HIPC client with releasing the memory space that the client has. 
enum HIPC_errno hipcClientGetHipcErrno(const struct HIPC_client *const cl_p)
Gets a HIPC error number that has been set. 
struct HIPC_ptr_link_list * next
struct HIPC_cl_indp const * indp_p
Machine-dependent information of a client. 
const char * hipcClientGetErrDtlStr(const struct HIPC_client *const cl_p)
Gets a string describing details of an error that has been set to a HIPC client. 
unsigned char hipcEndian(void)
Returns endian of the system. 
struct HIPC_cl_dp_stru * struct_p
struct HIPC_cl_dp * smdp_p
Server Machine DePendent data. 
unsigned char ** cimg_pp
Client-side images of structures.