dtn_ipc.h File Reference

#include <rpc/rpc.h>

Go to the source code of this file.

Classes

struct  dtnipc_handle
 State of a DTN IPC channel. More...

Defines

#define DTN_IPC_VERSION   3
 DTN IPC version.
#define DTN_IPC_PORT   5010
 Default api ports.
#define DTN_MAX_API_MSG   65536
 The maximum IPC message size (in bytes).

Typedefs

typedef struct
dtnipc_handle 
dtnipc_handle_t

Enumerations

enum  dtnapi_message_type_t {
  DTN_OPEN = 1, DTN_CLOSE = 2, DTN_LOCAL_EID = 3, DTN_REGISTER = 4,
  DTN_UNREGISTER = 5, DTN_FIND_REGISTRATION = 6, DTN_CHANGE_REGISTRATION = 7, DTN_BIND = 8,
  DTN_UNBIND = 9, DTN_SEND = 10, DTN_RECV = 11, DTN_BEGIN_POLL = 12,
  DTN_CANCEL_POLL = 13
}
 Type codes for api messages. More...

Functions

const char * dtnipc_msgtoa (u_int8_t type)
 Type code to string conversion routine.
int dtnipc_open (dtnipc_handle_t *handle)
int dtnipc_close (dtnipc_handle_t *handle)
int dtnipc_send (dtnipc_handle_t *handle, dtnapi_message_type_t type)
int dtnipc_recv (dtnipc_handle_t *handle, int *status)
int dtnipc_send_recv (dtnipc_handle_t *handle, dtnapi_message_type_t type)
 Send a message and wait for a response over the dtn ipc protocol.


Define Documentation

#define DTN_IPC_PORT   5010

Default api ports.

The handshake port is used for initial contact with the daemon to establish a session, and the latter is used for individual sessions.

Definition at line 53 of file dtn_ipc.h.

Referenced by dtn::APIServer::APIServer(), and dtnipc_open().

#define DTN_IPC_VERSION   3

DTN IPC version.

Just a simple number for now; we can refine it to a major/minor version later if desired.

Make sure to bump this when changing any data structures, message types, adding functions, etc.

Definition at line 46 of file dtn_ipc.h.

Referenced by dtnipc_open(), dtn::APIClient::handle_handshake(), and DTNOpenCommand::init_opts().

#define DTN_MAX_API_MSG   65536

The maximum IPC message size (in bytes).

Used primarily for efficiency in buffer allocation since the transport uses TCP.

Definition at line 59 of file dtn_ipc.h.

Referenced by dtn::APIClient::APIClient(), dtnipc_open(), and dtn::APIClient::run().


Typedef Documentation

typedef struct dtnipc_handle dtnipc_handle_t

Definition at line 73 of file dtn_ipc.h.


Enumeration Type Documentation

enum dtnapi_message_type_t

Type codes for api messages.

Enumerator:
DTN_OPEN 
DTN_CLOSE 
DTN_LOCAL_EID 
DTN_REGISTER 
DTN_UNREGISTER 
DTN_FIND_REGISTRATION 
DTN_CHANGE_REGISTRATION 
DTN_BIND 
DTN_UNBIND 
DTN_SEND 
DTN_RECV 
DTN_BEGIN_POLL 
DTN_CANCEL_POLL 

Definition at line 78 of file dtn_ipc.h.


Function Documentation

int dtnipc_close ( dtnipc_handle_t handle  ) 

Definition at line 170 of file dtn_ipc.c.

References DTN_CLOSE, DTN_ECOMM, dtnipc_send_recv(), dtnipc_handle::err, dtnipc_handle::sock, dtnipc_handle::xdr_decode, and dtnipc_handle::xdr_encode.

const char* dtnipc_msgtoa ( u_int8_t  type  ) 

Type code to string conversion routine.

Definition at line 37 of file dtn_ipc.c.

References CASE, DTN_BEGIN_POLL, DTN_BIND, DTN_CANCEL_POLL, DTN_CHANGE_REGISTRATION, DTN_CLOSE, DTN_FIND_REGISTRATION, DTN_LOCAL_EID, DTN_OPEN, DTN_RECV, DTN_REGISTER, DTN_SEND, and DTN_UNREGISTER.

int dtnipc_open ( dtnipc_handle_t handle  ) 

Definition at line 66 of file dtn_ipc.c.

References dtnipc_handle::buf, DTN_ECOMM, DTN_EMSGTYPE, DTN_IPC_PORT, DTN_IPC_VERSION, DTN_MAX_API_MSG, DTN_OPEN, dtnipc_close(), dtnipc_version, end, dtnipc_handle::err, dtnipc_handle::sock, dtnipc_handle::xdr_decode, and dtnipc_handle::xdr_encode.

int dtnipc_recv ( dtnipc_handle_t handle,
int *  status 
)

Definition at line 251 of file dtn_ipc.c.

References dtnipc_handle::buf, DTN_ECOMM, dtnipc_close(), dtnipc_handle::err, errno, dtnipc_handle::sock, and dtnipc_handle::xdr_decode.

int dtnipc_send ( dtnipc_handle_t handle,
dtnapi_message_type_t  type 
)

Definition at line 200 of file dtn_ipc.c.

References dtnipc_handle::buf, DTN_ECOMM, dtnipc_close(), dtnipc_handle::err, errno, dtnipc_handle::sock, and dtnipc_handle::xdr_encode.

int dtnipc_send_recv ( dtnipc_handle_t handle,
dtnapi_message_type_t  type 
)

Send a message and wait for a response over the dtn ipc protocol.

Returns 0 on success, -1 on error.

Definition at line 303 of file dtn_ipc.c.

References DTN_SUCCESS, dtnipc_recv(), dtnipc_send(), and dtnipc_handle::err.


Generated on Sat Sep 8 08:36:19 2007 for DTN Reference Implementation by  doxygen 1.5.3