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
00046 #define DTN_IPC_VERSION 3
00047
00053 #define DTN_IPC_PORT 5010
00054
00059 #define DTN_MAX_API_MSG 65536
00060
00064 struct dtnipc_handle {
00065 int sock;
00066 int err;
00067 int in_poll;
00068 char buf[DTN_MAX_API_MSG];
00069 XDR xdr_encode;
00070 XDR xdr_decode;
00071 };
00072
00073 typedef struct dtnipc_handle dtnipc_handle_t;
00074
00078 typedef enum {
00079 DTN_OPEN = 1,
00080 DTN_CLOSE = 2,
00081 DTN_LOCAL_EID = 3,
00082 DTN_REGISTER = 4,
00083 DTN_UNREGISTER = 5,
00084 DTN_FIND_REGISTRATION = 6,
00085 DTN_CHANGE_REGISTRATION = 7,
00086 DTN_BIND = 8,
00087 DTN_UNBIND = 9,
00088 DTN_SEND = 10,
00089 DTN_RECV = 11,
00090 DTN_BEGIN_POLL = 12,
00091 DTN_CANCEL_POLL = 13
00092 } dtnapi_message_type_t;
00093
00097 const char* dtnipc_msgtoa(u_int8_t type);
00098
00099
00100
00101
00102
00103
00104
00105 int dtnipc_open(dtnipc_handle_t* handle);
00106
00107
00108
00109
00110
00111
00112
00113 int dtnipc_close(dtnipc_handle_t* handle);
00114
00115
00116
00117
00118
00119
00120 int dtnipc_send(dtnipc_handle_t* handle, dtnapi_message_type_t type);
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130 int dtnipc_recv(dtnipc_handle_t* handle, int* status);
00131
00137 int dtnipc_send_recv(dtnipc_handle_t* handle, dtnapi_message_type_t type);
00138
00139
00140 #ifdef __cplusplus
00141 }
00142 #endif
00143
00144 #endif