00001 #ifndef DN_ADDITIONAL_H_
00002 #define DN_ADDITIONAL_H_
00003
00036 #define INADDR_ANY ((uint32_t)0x00000000)
00037 #define INADDR_NONE (0xffffffff)
00038
00039 #define SOCKET uint16_t
00040
00041 #ifndef FD_SETSIZE
00042 #define FD_SETSIZE (64)
00043 #endif
00044
00045 typedef struct fd_set
00046 {
00047 uint16_t fd_count;
00048 SOCKET fd_array[FD_SETSIZE];
00049 } fd_set;
00050
00051 #define FD_SET(fd, fdsetp)
00052 #define FD_ZERO(fdsetp)
00053
00054 struct timeval
00055 {
00056 long tv_sec;
00057 long tv_usec;
00058 };
00059
00060 #define DNGetLastError() (-1)
00061 #define OSSUCCEEDED(ret) ((ret) == 0)
00062 #define OSFAILED(ret) ((ret) == -1)
00063
00064 #define _E_BUSY_PROC (-1)
00065
00066 #define AF_INET (2)
00067 #define SOCK_STREAM (1)
00068 #define SOCK_DGRAM (2)
00069
00070 #define SOL_SOCKET (0xffff)
00071 #define SO_REUSEADDR (0x0004)
00072 #define SO_KEEPALIVE (0x0008)
00073 #define SO_SNDTIMEO (0x1005)
00074 #define SO_RCVTIMEO (0x1006)
00075
00076 #define IPPROTO_TCP (6)
00077 #define TCP_NODELAY (0x0001)
00078
00079 #define MSG_PEEK (0x02)
00080
00081 #define F_GETFL (3)
00082 #define F_SETFL (4)
00083 #define O_NONBLOCK (04000)
00084
00085 typedef struct in_addr
00086 {
00087 union
00088 {
00089 struct
00090 {
00091 uint8_t s_b1, s_b2, s_b3, s_b4;
00092 } S_un_b;
00093 struct
00094 {
00095 uint16_t s_w1, s_w2;
00096 } S_un_w;
00097 uint32_t S_addr;
00098 } S_un;
00099
00100 #define s_addr S_un.S_addr
00101 #define s_host S_un.S_un_b.s_b2 // host on imp
00102 #define s_net S_un.S_un_b.s_b1 // network
00103 #define s_imp S_un.S_un_w.s_w2 // imp
00104 #define s_impno S_un.S_un_b.s_b4 // imp #
00105 #define s_lh S_un.S_un_b.s_b3 // logical host
00106 } IN_ADDR, *PIN_ADDR, *LPIN_ADDR;
00107
00108 struct sockaddr_in
00109 {
00110 short sin_family;
00111 uint16_t sin_port;
00112 struct in_addr sin_addr;
00113 char sin_zero[8];
00114 };
00115
00116 struct sockaddr
00117 {
00118 uint16_t sa_family;
00119 char sa_data[14];
00120 };
00121
00122 typedef int socklen_t;
00123
00124 #define COM_BITS_CTS (0)
00125 typedef int COM_STATE;
00126
00127 #define begin_thread(p_thread, function, arg)
00128 #define exit_thread(thread)
00129 #define dn_sleep(n)
00130 typedef int MUTEX;
00131 typedef int THREAD;
00132 #define THRET void
00133 #define THTYPE
00134 #define STATUS_WAIT_0 ((uint32_t)0x00000000L)
00135 #define WAIT_OBJECT_0 ((STATUS_WAIT_0) + 0)
00136 typedef int EVENT;
00137
00138 #ifdef __cplusplus
00139 extern "C"
00140 {
00141 #endif
00142
00143 static uint16_t
00144 htons(uint16_t hostshort)
00145 {
00146 return 0;
00147 }
00148
00149 static uint32_t
00150 htonl(uint32_t hostlong)
00151 {
00152 return 0;
00153 }
00154
00155 static uint32_t
00156 inet_addr(const char *addr)
00157 {
00158 return 0;
00159 }
00160
00161 static int
00162 select(int __nfds, fd_set *__restrict __readfds,
00163 fd_set *__restrict __writefds, fd_set *__restrict __exceptfds,
00164 struct timeval *__restrict __timeout)
00165 {
00166 return -1;
00167 }
00168
00169 static int
00170 socket(int af, int type, int protocol)
00171 {
00172 return -1;
00173 }
00174
00175 static int
00176 bind(SOCKET s, const struct sockaddr *name, int namelen)
00177 {
00178 return -1;
00179 }
00180
00181 static int
00182 setsockopt(SOCKET s, int level, int optname, const char *optval, int optlen)
00183 {
00184 return -1;
00185 }
00186
00187 static int
00188 connect(SOCKET s, const struct sockaddr *name, int namelen)
00189 {
00190 return -1;
00191 }
00192
00193 static int
00194 listen(SOCKET s, int backlog)
00195 {
00196 return -1;
00197 }
00198
00199 static SOCKET
00200 accept(SOCKET s, struct sockaddr *addr, int *addrlen)
00201 {
00202 return -1;
00203 }
00204
00205 static int
00206 send(SOCKET s, const char *buf, int len, int flags)
00207 {
00208 return -1;
00209 }
00210
00211 static int
00212 recv(SOCKET s, char *buf, int len, int flags)
00213 {
00214 return -1;
00215 }
00216
00217 static int32_t
00218 _tcp_set_keepalive(int sock, int enable, uint32_t idle, uint32_t interval,
00219 uint32_t count)
00220 {
00221 return -1;
00222 }
00223
00224 static int
00225 sendto(SOCKET s, const char *buf, int len, int flags,
00226 const struct sockaddr *to, int tolen)
00227 {
00228 return -1;
00229 }
00230
00231 static int
00232 recvfrom(SOCKET s, char *buf, int len, int flags, struct sockaddr *from,
00233 int *fromlen)
00234 {
00235 return -1;
00236 }
00237
00238 static int
00239 _socket_close(int sock)
00240 {
00241 return -1;
00242 }
00243
00244 static int32_t
00245 _socket_bind(const void *param, int *sock)
00246 {
00247 return -1;
00248 }
00249
00250 static int32_t
00251 _com_open(const void *com_param, int *sock)
00252 {
00253 return -1;
00254 }
00255
00256 static int
00257 _com_close(int sock)
00258 {
00259 return -1;
00260 }
00261
00262 static int
00263 _com_send(int sock, const char *buf, uint32_t len_send, uint32_t *len_sended,
00264 void *arg)
00265 {
00266 return -1;
00267 }
00268
00269 static int
00270 _com_recv(int sock, char *buf, uint32_t len_recv, uint32_t *len_recved,
00271 uint32_t timeout, void *arg)
00272 {
00273 return -1;
00274 }
00275
00276 static int32_t
00277 _com_set_timeout(int sock, uint32_t timeout)
00278 {
00279 return -1;
00280 }
00281
00282 static int32_t
00283 _com_clear(int sock, uint32_t timeout)
00284 {
00285 return -1;
00286 }
00287
00288 static int
00289 _com_get_state(int sock, COM_STATE *state)
00290 {
00291 return -1;
00292 }
00293
00294 static int
00295 _com_set_state(int sock, COM_STATE *state)
00296 {
00297 return -1;
00298 }
00299
00300 static int
00301 _com_get_modem_state(int sock, uint32_t *state)
00302 {
00303 return -1;
00304 }
00305
00306 static int32_t
00307 _initialize_mutex(MUTEX *pmutex)
00308 {
00309 return -1;
00310 }
00311
00312 static int32_t
00313 _release_mutex(MUTEX *pmutex)
00314 {
00315 return -1;
00316 }
00317
00318 static int32_t
00319 _lock_mutex(MUTEX *pmutex, uint32_t timeout)
00320 {
00321 return -1;
00322 }
00323
00324 static int32_t
00325 _unlock_mutex(MUTEX *pmutex)
00326 {
00327 return -1;
00328 }
00329
00330 static int32_t
00331 _create_event(EVENT *pevt, int reset_mode, int init_signal)
00332 {
00333 return -1;
00334 }
00335
00336 static int32_t
00337 _destroy_event(EVENT *pevt)
00338 {
00339 return -1;
00340 }
00341
00342 static int32_t
00343 _set_event(EVENT *pevt)
00344 {
00345 return -1;
00346 }
00347
00348 static int32_t
00349 _reset_event(EVENT *pevt)
00350 {
00351 return -1;
00352 }
00353
00354 static int32_t
00355 _wait_event(EVENT *pevt, uint32_t timeout)
00356 {
00357 return -1;
00358 }
00359
00360 static int32_t
00361 _wait_event_multi(EVENT **pevt, uint32_t count, uint32_t timeout,
00362 int wait_all)
00363 {
00364 return -1;
00365 }
00366
00367 static uint32_t
00368 _gettimeofday_msec()
00369 {
00370 return 0;
00371 }
00372
00373
00374 #ifdef __cplusplus
00375 }
00376 #endif
00377
00378 #endif