HIPC  0.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
session.h
Go to the documentation of this file.
1 #ifndef HIPC_SESSION_H
2 #define HIPC_SESSION_H
3 
4 #include <hipc.h>
5 #include <hipc/msg.h>
6 #include <hipc/client.h>
7 
9  HIPC_SESS_TERMINATED = 0, /* TERMINATED is the most suitable state for uninitialized sessions. */
12 };
13 
14 struct HIPC_session {
15  struct HIPC_client cl;
17  enum HIPC_errno (*rfnc_p) (void *, hipc_msg);
18  void *rarg;
19  enum HIPC_errno (*wfnc_p) (void *, const hipc_msg);
20  void *warg;
21 };
22 typedef struct HIPC_session hipc_session;
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28  extern enum HIPC_errno hipcRecvMsg(hipc_session * const sess_p,
29  hipc_msg msgR);
30  extern enum HIPC_errno hipcSendMsg(hipc_session * const sess_p,
31  hipc_msg msgS);
32  extern enum HIPC_errno hipcWaitReturn(hipc_session * const sess_p,
33  hipc_msg msgR);
34 
35  extern enum HIPC_errno
36  hipcOpen(hipc_session * const sess_p,
37  struct HIPC_client const *const clbase_p,
38  enum HIPC_errno (*rfnc_p) (void *, hipc_msg),
39  void *rarg,
40  enum HIPC_errno (*wfnc_p) (void *, const hipc_msg),
41  void *warg);
42  extern enum HIPC_errno
43  hipcClose(hipc_session * const sess_p);
44  extern enum HIPC_errno
45  hipcSetHandler(hipc_session * const sess_p,
46  char const *const str,
47  void *const cimg,
48  enum HIPC_errno (*hndlr_p) (struct HIPC_client *,
49  const hipc_msg, void *,
50  void *), void *const arg);
51  extern enum HIPC_errno
52  hipcGet(hipc_session * const sess_p,
53  char const *const str, void *const cimg);
54  extern enum HIPC_errno
55  hipcPut(hipc_session * const sess_p,
56  char const *const str, void *const cimg);
57 
58 
59  void hipcERRCHECK(hipc_session const *const sess_p,
60  char const *const filename, const int lineno);
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 
72 #define HIPC_ERRCHECK(sess_p) hipcERRCHECK(sess_p, __FILE__, __LINE__)
73 #endif
void * warg
Definition: session.h:20
enum HIPC_errno hipcRecvMsg(hipc_session *const sess_p, hipc_msg msgR)
Receives a HIPC message.
Definition: session.c:56
unsigned char hipc_msg[HIPC_MSG_ALLOCSIZE]
Definition: msg.h:8
enum HIPC_errno hipcSendMsg(hipc_session *const sess_p, hipc_msg msgS)
Sends a HIPC message.
Definition: session.c:76
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.
Definition: session.c:312
enum HIPC_errno(* wfnc_p)(void *, const hipc_msg)
Definition: session.h:19
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.
Definition: session.c:361
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.
Definition: session.c:217
HIPC_errno
Definition: hipc.h:4
void * rarg
Definition: session.h:18
void hipcERRCHECK(hipc_session const *const sess_p, char const *const filename, const int lineno)
Checks whether an error has occurred.
Definition: session.c:17
enum HIPC_session_state state
Definition: session.h:16
enum HIPC_errno hipcWaitReturn(hipc_session *const sess_p, hipc_msg msgR)
Waits a return message from a HIPC server.
Definition: session.c:98
HIPC_session_state
Definition: session.h:8
struct HIPC_client cl
Definition: session.h:15
enum HIPC_errno hipcClose(hipc_session *const sess_p)
Closes a session.
Definition: session.c:276
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.
Definition: session.c:174
enum HIPC_errno(* rfnc_p)(void *, hipc_msg)
Definition: session.h:17