00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef DTN_IPC_H
00018 #define DTN_IPC_H
00019
00020 #include <rpc/rpc.h>
00021
00022 #ifdef __CYGWIN__
00023 #include <stdio.h>
00024 #include <string.h>
00025 #include <cygwin/socket.h>
00026 #endif
00027
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031
00032
00033
00034
00035
00036
00037
00038
00048 #define DTN_IPC_VERSION 6
00049
00055 #define DTN_IPC_PORT 5010
00056
00061 #define DTN_MAX_API_MSG 65536
00062
00066 struct dtnipc_handle {
00067 int sock;
00068 int err;
00069 int in_poll;
00070 int debug;
00071 char buf[DTN_MAX_API_MSG];
00072 XDR xdr_encode;
00073 XDR xdr_decode;
00074 unsigned int total_sent;
00075 unsigned int total_rcvd;
00076 };
00077
00078 typedef struct dtnipc_handle dtnipc_handle_t;
00079
00083 typedef enum {
00084 DTN_OPEN = 1,
00085 DTN_CLOSE = 2,
00086 DTN_LOCAL_EID = 3,
00087 DTN_REGISTER = 4,
00088 DTN_UNREGISTER = 5,
00089 DTN_FIND_REGISTRATION = 6,
00090 DTN_CHANGE_REGISTRATION = 7,
00091 DTN_BIND = 8,
00092 DTN_UNBIND = 9,
00093 DTN_SEND = 10,
00094 DTN_RECV = 11,
00095 DTN_BEGIN_POLL = 12,
00096 DTN_CANCEL_POLL = 13,
00097 DTN_CANCEL = 14,
00098 DTN_SESSION_UPDATE = 15
00099 } dtnapi_message_type_t;
00100
00104 const char* dtnipc_msgtoa(u_int8_t type);
00105
00106
00107
00108
00109
00110
00111
00112 int dtnipc_open(dtnipc_handle_t* handle);
00113
00114
00115
00116
00117
00118
00119
00120 int dtnipc_close(dtnipc_handle_t* handle);
00121
00122
00123
00124
00125
00126
00127 int dtnipc_send(dtnipc_handle_t* handle, dtnapi_message_type_t type);
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137 int dtnipc_recv(dtnipc_handle_t* handle, int* status);
00138
00144 int dtnipc_send_recv(dtnipc_handle_t* handle, dtnapi_message_type_t type);
00145
00146
00147 #ifdef __cplusplus
00148 }
00149 #endif
00150
00151 #endif