Go to the source code of this file.
Data Structures | |
struct | HIPC_session |
Macros | |
#define | HIPC_ERRCHECK(sess_p) hipcERRCHECK(sess_p, __FILE__, __LINE__) |
Checks whether an error has occurred. More... | |
Typedefs | |
typedef struct HIPC_session | hipc_session |
Enumerations | |
enum | HIPC_session_state { HIPC_SESS_TERMINATED = 0, HIPC_SESS_QUITTED, HIPC_SESS_ESTABLISHED } |
Functions | |
enum HIPC_errno | hipcRecvMsg (hipc_session *const sess_p, hipc_msg msgR) |
Receives a HIPC message. More... | |
enum HIPC_errno | hipcSendMsg (hipc_session *const sess_p, hipc_msg msgS) |
Sends a HIPC message. More... | |
enum HIPC_errno | hipcWaitReturn (hipc_session *const sess_p, hipc_msg msgR) |
Waits a return message from a HIPC server. More... | |
enum HIPC_errno | hipcOpen (hipc_session *const sess_p, struct HIPC_client const *const clbase_p, enum HIPC_errno(*rfnc_p)(void *, hipc_msg), void *rarg, enum HIPC_errno(*wfnc_p)(void *, const hipc_msg), void *warg) |
Open a session to a HIPC server. More... | |
enum HIPC_errno | hipcClose (hipc_session *const sess_p) |
Closes a session. More... | |
enum HIPC_errno | hipcSetHandler (hipc_session *const sess_p, char const *const str, void *const cimg, enum HIPC_errno(*hndlr_p)(struct HIPC_client *, const hipc_msg, void *, void *), void *const arg) |
Set a handler to a structure type. More... | |
enum HIPC_errno | hipcGet (hipc_session *const sess_p, char const *const str, void *const cimg) |
Gets data specified by str from a HIPC server. More... | |
enum HIPC_errno | hipcPut (hipc_session *const sess_p, char const *const str, void *const cimg) |
Puts data specified by str from a HIPC server. More... | |
void | hipcERRCHECK (hipc_session const *const sess_p, char const *const filename, const int lineno) |
Checks whether an error has occurred. More... | |
#define HIPC_ERRCHECK | ( | sess_p | ) | hipcERRCHECK(sess_p, __FILE__, __LINE__) |
Checks whether an error has occurred.
See hipcERRCHECK() for more details.
sess_p | pointer to a HIPC session. |
typedef struct HIPC_session hipc_session |
enum HIPC_session_state |
enum HIPC_errno hipcRecvMsg | ( | hipc_session *const | sess_p, |
hipc_msg | msgR | ||
) |
Receives a HIPC message.
sess_p | pointer to a HIPC session. |
msgR | message received |
Definition at line 56 of file session.c.
References HIPC_session::cl, HIPC_SUCCESS, hipcClientSetError(), hipcClientSetStdErrno(), HIPC_session::rarg, and HIPC_session::rfnc_p.
Referenced by hipcOpen(), and hipcWaitReturn().
enum HIPC_errno hipcSendMsg | ( | hipc_session *const | sess_p, |
hipc_msg | msgS | ||
) |
Sends a HIPC message.
sess_p | pointer to a HIPC session. |
msgS | message to be sent |
Definition at line 76 of file session.c.
References HIPC_session::cl, HIPC_SUCCESS, hipcClientSetError(), hipcClientSetStdErrno(), HIPC_session::warg, and HIPC_session::wfnc_p.
Referenced by hipcClose(), hipcGet(), hipcOpen(), and hipcPut().
enum HIPC_errno hipcWaitReturn | ( | hipc_session *const | sess_p, |
hipc_msg | msgR | ||
) |
Waits a return message from a HIPC server.
If a CAST messages is received while waiting, this function calls a handler.
sess_p | pointer to a HIPC session. |
msgR | last message received |
Definition at line 98 of file session.c.
References HIPC_session::cl, HIPC_ERR_PROTOCOL_VIOLATION, HIPC_ERR_SESS_STATE_MISMATCH, HIPC_MESSAGE_TYPE_CAST, HIPC_MESSAGE_TYPE_QUIT, HIPC_MESSAGE_TYPE_SUCCESS, HIPC_SESS_ESTABLISHED, HIPC_SESS_QUITTED, HIPC_SUCCESS, HIPC_UNSTRU, hipcClientCallHandler(), hipcClientFeedStrumsg(), hipcClientFeedUnstrumsgAsError(), hipcClientGetHipcErrno(), hipcClientSetError(), hipcClientUnpack(), hipcMsgOffset(), hipcMsgRngsize(), hipcMsgStruno(), hipcMsgType(), hipcRecvMsg(), and HIPC_session::state.
Referenced by hipcClose(), hipcGet(), and hipcPut().
enum HIPC_errno hipcOpen | ( | hipc_session *const | sess_p, |
struct HIPC_client const *const | clbase_p, | ||
enum HIPC_errno(*)(void *, hipc_msg) | rfnc_p, | ||
void * | rarg, | ||
enum HIPC_errno(*)(void *, const hipc_msg) | wfnc_p, | ||
void * | warg | ||
) |
Open a session to a HIPC server.
The server is specified by clbase_p
. Also, read/write functions to communicate with the server must be given as arguments.
sess_p | pointer to a HIPC session. |
clbase_p | HIPC client as a base for the session |
rfnc_p | pointer to a function that reads a HIPC message |
rarg | argument passed to the function of rfnc_p |
wfnc_p | pointer to a function that writes a HIPC message |
warg | argument passed to the function of wfnc_p |
Definition at line 217 of file session.c.
References HIPC_session::cl, HIPC_MESSAGE_TYPE_QUIT, HIPC_SESS_ESTABLISHED, HIPC_SESS_QUITTED, HIPC_SUCCESS, hipcClientCheckMbrSize(), hipcClientFeedSysmsg(), hipcClientFeedUnstrumsgAsError(), hipcClientGetNsysmsg(), hipcClientInit(), hipcGenmsgHello(), hipcMsgType(), hipcRecvMsg(), hipcSendMsg(), HIPC_session::rarg, HIPC_session::rfnc_p, HIPC_session::state, HIPC_session::warg, and HIPC_session::wfnc_p.
enum HIPC_errno hipcClose | ( | hipc_session *const | sess_p | ) |
Closes a session.
Data about the session are cleared even if an error occurs in communication with a server for the close.
sess_p | pointer to a HIPC session. |
Definition at line 276 of file session.c.
References HIPC_session::cl, HIPC_SESS_ESTABLISHED, HIPC_SESS_TERMINATED, HIPC_SUCCESS, hipcClientTerminate(), hipcGenmsgBye(), hipcSendMsg(), hipcWaitReturn(), HIPC_session::rarg, HIPC_session::rfnc_p, HIPC_session::state, HIPC_session::warg, and HIPC_session::wfnc_p.
enum HIPC_errno hipcSetHandler | ( | hipc_session *const | sess_p, |
char const *const | str, | ||
void *const | cimg, | ||
enum HIPC_errno(*)(struct HIPC_client *, const hipc_msg, void *, void *) | hndlr_p, | ||
void *const | arg | ||
) |
Set a handler to a structure type.
The handler will be called when a CAST message of the type is received.
sess_p | pointer to a HIPC session. |
str | string that identifies the structure type. |
cimg | client-side image |
hndlr_p | handler |
arg | argument to be passed to the handler |
Definition at line 174 of file session.c.
References HIPC_session::cl, HIPC_ERR_SESS_STATE_MISMATCH, HIPC_SESS_ESTABLISHED, HIPC_SUCCESS, hipcClientGetStrutpl(), hipcClientSetCimg(), hipcClientSetError(), hipcClientSetHandler(), and HIPC_session::state.
enum HIPC_errno hipcGet | ( | hipc_session *const | sess_p, |
char const *const | str, | ||
void *const | cimg | ||
) |
Gets data specified by str
from a HIPC server.
The data are unpacked to cimg
.
sess_p | pointer to a HIPC session. |
str | string that identifies an item to be gotten |
cimg | Client-side image of the structure |
Definition at line 312 of file session.c.
References HIPC_session::cl, HIPC_ERR_SESS_STATE_MISMATCH, HIPC_SESS_ESTABLISHED, HIPC_SUCCESS, hipcClientGetStrutpl(), hipcClientSetError(), hipcClientUnpack(), hipcGenmsgGet(), hipcSendMsg(), hipcWaitReturn(), and HIPC_session::state.
enum HIPC_errno hipcPut | ( | hipc_session *const | sess_p, |
char const *const | str, | ||
void *const | cimg | ||
) |
Puts data specified by str
from a HIPC server.
This function packs contents of cimg
and puts it.
sess_p | pointer to a HIPC session. |
str | string that identifies an item to be put |
cimg | Client-side image of the structure |
Definition at line 361 of file session.c.
References HIPC_session::cl, HIPC_ERR_SESS_STATE_MISMATCH, HIPC_SESS_ESTABLISHED, HIPC_SUCCESS, hipcClientGetStrutpl(), hipcClientPack(), hipcClientSetError(), hipcGenmsgPut(), hipcSendMsg(), hipcWaitReturn(), and HIPC_session::state.
void hipcERRCHECK | ( | const hipc_session *const | sess_p, |
const char *const | filename, | ||
const int | lineno | ||
) |
Checks whether an error has occurred.
If an error is detected, this function terminates the process after printing error location, which consists of filename
, lineno
, and function
, and error details to stderr
.
sess_p | pointer to a HIPC session. |
filename | file name |
lineno | line number |
Definition at line 17 of file session.c.
References HIPC_session::cl, HIPC_SUCCESS, hipcClientGetErrDtlStr(), hipcClientGetErrStr(), hipcClientGetHipcErrno(), and hipcClientGetStdErrno().