Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

ipc.h File Reference

#include <gwenhywfar/types.h>
#include <gwenhywfar/db.h>
#include <gwenhywfar/nettransport.h>
#include <gwenhywfar/netconnection.h>
#include <time.h>
#include <stdio.h>

Go to the source code of this file.

Error codes

#define GWEN_IPC_ERROR_CODES   0x80000000
#define GWEN_IPC_ERROR_CONNERR   0x80000002
#define GWEN_IPC_ERROR_GENERIC   0x80000001
#define GWEN_IPC_ERROR_TIMEOUT   0x80000003

Typedefs

typedef GWEN_IPCMANAGER GWEN_IPCMANAGER

Functions

GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_IPCManager_AddClient (GWEN_IPCMANAGER *mgr, GWEN_NETTRANSPORT *tr, const char *userName, const char *passwd, GWEN_TYPE_UINT32 mark)
GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_IPCManager_AddServer (GWEN_IPCMANAGER *mgr, GWEN_NETTRANSPORT *tr, GWEN_TYPE_UINT32 mark)
GWENHYWFAR_API void GWEN_IPCManager_Attach (GWEN_IPCMANAGER *mgr)
GWENHYWFAR_API GWEN_NETTRANSPORT_STATUS GWEN_IPCManager_CheckConnection (GWEN_IPCMANAGER *mgr, GWEN_TYPE_UINT32 nid)
GWENHYWFAR_API int GWEN_IPCManager_Disconnect (GWEN_IPCMANAGER *mgr, GWEN_TYPE_UINT32 nid)
GWENHYWFAR_API void GWEN_IPCManager_Dump (GWEN_IPCMANAGER *mgr, FILE *f, int indent)
GWENHYWFAR_API void GWEN_IPCManager_free (GWEN_IPCMANAGER *mgr)
GWENHYWFAR_API const char * GWEN_IPCManager_GetApplicationName (const GWEN_IPCMANAGER *mgr)
GWENHYWFAR_API GWEN_NETCONNECTIONGWEN_IPCManager_GetConnection (GWEN_IPCMANAGER *mgr, GWEN_TYPE_UINT32 nid)
GWENHYWFAR_API GWEN_DB_NODEGWEN_IPCManager_GetInRequestData (GWEN_IPCMANAGER *mgr, GWEN_TYPE_UINT32 rid)
GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_IPCManager_GetNextInRequest (GWEN_IPCMANAGER *mgr, GWEN_TYPE_UINT32 mark)
GWENHYWFAR_API GWEN_DB_NODEGWEN_IPCManager_GetResponseData (GWEN_IPCMANAGER *mgr, GWEN_TYPE_UINT32 rid)
GWENHYWFAR_API GWEN_IPCMANAGERGWEN_IPCManager_new ()
GWENHYWFAR_API GWEN_DB_NODEGWEN_IPCManager_PeekResponseData (GWEN_IPCMANAGER *mgr, GWEN_TYPE_UINT32 rid)
GWENHYWFAR_API int GWEN_IPCManager_RemoveClient (GWEN_IPCMANAGER *mgr, GWEN_TYPE_UINT32 nid)
GWENHYWFAR_API int GWEN_IPCManager_RemoveRequest (GWEN_IPCMANAGER *mgr, GWEN_TYPE_UINT32 rid, int outbound)
GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_IPCManager_SendMultiRequest (GWEN_IPCMANAGER *mgr, GWEN_TYPE_UINT32 mark, GWEN_DB_NODE *req)
GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_IPCManager_SendRequest (GWEN_IPCMANAGER *mgr, GWEN_TYPE_UINT32 nid, GWEN_DB_NODE *req)
GWENHYWFAR_API int GWEN_IPCManager_SendResponse (GWEN_IPCMANAGER *mgr, GWEN_TYPE_UINT32 rid, GWEN_DB_NODE *rsp)
GWENHYWFAR_API void GWEN_IPCManager_SetApplicationName (GWEN_IPCMANAGER *mgr, const char *name)
GWENHYWFAR_API void GWEN_IPCManager_SetDownFn (GWEN_IPCMANAGER *mgr, GWEN_TYPE_UINT32 id, GWEN_NETCONNECTION_DOWNFN fn)
GWENHYWFAR_API void GWEN_IPCManager_SetUpFn (GWEN_IPCMANAGER *mgr, GWEN_TYPE_UINT32 id, GWEN_NETCONNECTION_UPFN fn)
GWENHYWFAR_API int GWEN_IPCManager_Work (GWEN_IPCMANAGER *mgr, int maxmsg)


Define Documentation

#define GWEN_IPC_ERROR_CODES   0x80000000
 

#define GWEN_IPC_ERROR_CONNERR   0x80000002
 

#define GWEN_IPC_ERROR_GENERIC   0x80000001
 

#define GWEN_IPC_ERROR_TIMEOUT   0x80000003
 


Typedef Documentation

typedef struct GWEN_IPCMANAGER GWEN_IPCMANAGER
 


Function Documentation

GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_IPCManager_AddClient GWEN_IPCMANAGER mgr,
GWEN_NETTRANSPORT tr,
const char *  userName,
const char *  passwd,
GWEN_TYPE_UINT32  mark
 

Adds a client to the IPC manager. The connection will not be established until needed.

Returns:
node id of the node created (0 on error)
Parameters:
mgr pointer to the IPC manager object
tr transport layer to be used (this MUST not be connected or in listening state)
userName if given this name will be used for HTTP authorization
passwd if given this password will be used for HTTP authorization
mark a value assigned to the new connection. This value can be used for functions GWEN_IPCManager_GetNextInRequest and GWEN_IPCManager_SendMultiRequest, it is not otherwise used by the IPC manager

GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_IPCManager_AddServer GWEN_IPCMANAGER mgr,
GWEN_NETTRANSPORT tr,
GWEN_TYPE_UINT32  mark
 

Adds a server to the IPC manager. The IPC manager will immediately enter listen mode on the given transport layer.

Returns:
node id of the node created (0 on error)
Parameters:
mgr pointer to the IPC manager object
tr transport layer to be used (this MUST not be connected or in listening state)
mark a value assigned to the new connection. This value can be used for functions GWEN_IPCManager_GetNextInRequest and GWEN_IPCManager_SendMultiRequest, it is not otherwise used by the IPC manager

GWENHYWFAR_API void GWEN_IPCManager_Attach GWEN_IPCMANAGER mgr  ) 
 

GWENHYWFAR_API GWEN_NETTRANSPORT_STATUS GWEN_IPCManager_CheckConnection GWEN_IPCMANAGER mgr,
GWEN_TYPE_UINT32  nid
 

Updates the connection status and returns it. You can use this function to check whether a connection is broken.

GWENHYWFAR_API int GWEN_IPCManager_Disconnect GWEN_IPCMANAGER mgr,
GWEN_TYPE_UINT32  nid
 

Starts disconnecting the given client/server.

GWENHYWFAR_API void GWEN_IPCManager_Dump GWEN_IPCMANAGER mgr,
FILE *  f,
int  indent
 

GWENHYWFAR_API void GWEN_IPCManager_free GWEN_IPCMANAGER mgr  ) 
 

GWENHYWFAR_API const char* GWEN_IPCManager_GetApplicationName const GWEN_IPCMANAGER mgr  ) 
 

GWENHYWFAR_API GWEN_NETCONNECTION* GWEN_IPCManager_GetConnection GWEN_IPCMANAGER mgr,
GWEN_TYPE_UINT32  nid
 

Returns a pointer to the connection used by the given node.

GWENHYWFAR_API GWEN_DB_NODE* GWEN_IPCManager_GetInRequestData GWEN_IPCMANAGER mgr,
GWEN_TYPE_UINT32  rid
 

Returns the GWEN_DB of the incoming request with the given id. The IPC manager remains the owner of the DB returned.

The DB returned contains a special group called IPC, which in turn contains some interesting variables:

  • nodeId: Id of the node via which this request has been received
  • msgId: id of the message
Parameters:
mgr pointer to the IPC manager object
rid request id returned by GWEN_IPCManager_GetNextInRequest

GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_IPCManager_GetNextInRequest GWEN_IPCMANAGER mgr,
GWEN_TYPE_UINT32  mark
 

Returns the id of the next incoming request with the given mark. This request will then be taken of the list of new requests, so the next call to this function will return another request id (or 0 if there is none left). So you will have to preserve the id returned in order to use it.

Parameters:
mgr pointer to the IPC manager object
mark,0 matches any (see GWEN_IPCManager_AddServer)

GWENHYWFAR_API GWEN_DB_NODE* GWEN_IPCManager_GetResponseData GWEN_IPCMANAGER mgr,
GWEN_TYPE_UINT32  rid
 

Returns the next response to the given outbound request. The data returned is taken off the list of responses, so any call to this function will return the next response (if any). The caller takes over ownership of the data returned.

Parameters:
mgr pointer to the IPC manager object
rid request id returned by GWEN_IPCManager_SendRequest or GWEN_IPCManager_SendMultiRequest

GWENHYWFAR_API GWEN_IPCMANAGER* GWEN_IPCManager_new  ) 
 

GWENHYWFAR_API GWEN_DB_NODE* GWEN_IPCManager_PeekResponseData GWEN_IPCMANAGER mgr,
GWEN_TYPE_UINT32  rid
 

Returns the next response to the given outbound request. The data returned is not taken off the list of responses, so the next call to this function will return the same response (if any). The caller does NOT take over ownership of the data returned.

Parameters:
mgr pointer to the IPC manager object
rid request id returned by GWEN_IPCManager_SendRequest or GWEN_IPCManager_SendMultiRequest

GWENHYWFAR_API int GWEN_IPCManager_RemoveClient GWEN_IPCMANAGER mgr,
GWEN_TYPE_UINT32  nid
 

Removes a client which was previously added using GWEN_IPCManager_AddClient. This function removes all pending messages and/or requests for/from this client.

GWENHYWFAR_API int GWEN_IPCManager_RemoveRequest GWEN_IPCMANAGER mgr,
GWEN_TYPE_UINT32  rid,
int  outbound
 

Removes a request.

Parameters:
mgr pointer to the IPC manager object
rid id of the request to which this is a response (as returned by GWEN_IPCManager_GetNextInRequest, GWEN_IPCManager_SendRequest or GWEN_IPCManager_SendMultiRequest)
outbound if 0 then an incoming request is to be removed, otherwise an outgoing request is to be deleted

GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_IPCManager_SendMultiRequest GWEN_IPCMANAGER mgr,
GWEN_TYPE_UINT32  mark,
GWEN_DB_NODE req
 

Sends a request to any connection of the given mark.

Returns:
request id of the request created (0 on error)
Parameters:
mgr pointer to the IPC manager object
mark mark (as given to GWEN_IPCManager_AddClient or GWEN_IPCManager_AddServer), 0 matches all
req DB containing the request

GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_IPCManager_SendRequest GWEN_IPCMANAGER mgr,
GWEN_TYPE_UINT32  nid,
GWEN_DB_NODE req
 

Sends a request via the given connection. It takes over the ownership of the given GWEN_DB in any case.

Returns:
request id of the request created (0 on error)
Parameters:
mgr pointer to the IPC manager object
nid value returned by GWEN_IPCManager_AddClient or by GWEN_IPCManager_GetInRequestData (in variable "ipc/nodeId");
req DB containing the request

GWENHYWFAR_API int GWEN_IPCManager_SendResponse GWEN_IPCMANAGER mgr,
GWEN_TYPE_UINT32  rid,
GWEN_DB_NODE rsp
 

Sends a response to a request received.

Returns:
0 if ok, !=0 on error
Parameters:
mgr pointer to the IPC manager object
rid id of the request to which this is a response (as returned by GWEN_IPCManager_GetNextInRequest)
rsp DB containing the response

GWENHYWFAR_API void GWEN_IPCManager_SetApplicationName GWEN_IPCMANAGER mgr,
const char *  name
 

GWENHYWFAR_API void GWEN_IPCManager_SetDownFn GWEN_IPCMANAGER mgr,
GWEN_TYPE_UINT32  id,
GWEN_NETCONNECTION_DOWNFN  fn
 

Sets a callback function which is called for every network connection that went down.

GWENHYWFAR_API void GWEN_IPCManager_SetUpFn GWEN_IPCMANAGER mgr,
GWEN_TYPE_UINT32  id,
GWEN_NETCONNECTION_UPFN  fn
 

Sets a callback function which is called for every network connection that went up.

GWENHYWFAR_API int GWEN_IPCManager_Work GWEN_IPCMANAGER mgr,
int  maxmsg
 

Lets the IPC manager do its work. You need to call GWEN_Net_HeartBeat before this function to catch changes in the network connections used.


Generated on Thu Oct 13 04:23:13 2005 for gwenhywfar by  doxygen 1.4.1