1 #ifndef DN_ADDITIONAL_H_ 2 #define DN_ADDITIONAL_H_ 36 #define INADDR_ANY ((uint32_t)0x00000000) 37 #define INADDR_NONE (0xffffffff) 39 #define SOCKET uint16_t 42 #define FD_SETSIZE (64) 51 #define FD_SET(fd, fdsetp) 52 #define FD_ZERO(fdsetp) 60 #define DNGetLastError() (-1) 61 #define OSSUCCEEDED(ret) ((ret) == 0) 62 #define OSFAILED(ret) ((ret) == -1) 64 #define _E_BUSY_PROC (-1) 67 #define SOCK_STREAM (1) 68 #define SOCK_DGRAM (2) 70 #define SOL_SOCKET (0xffff) 71 #define SO_REUSEADDR (0x0004) 72 #define SO_KEEPALIVE (0x0008) 73 #define SO_SNDTIMEO (0x1005) 74 #define SO_RCVTIMEO (0x1006) 76 #define IPPROTO_TCP (6) 77 #define TCP_NODELAY (0x0001) 79 #define MSG_PEEK (0x02) 83 #define O_NONBLOCK (04000) 100 #define s_addr S_un.S_addr 101 #define s_host S_un.S_un_b.s_b2 // host on imp 102 #define s_net S_un.S_un_b.s_b1 // network 103 #define s_imp S_un.S_un_w.s_w2 // imp 104 #define s_impno S_un.S_un_b.s_b4 // imp # 105 #define s_lh S_un.S_un_b.s_b3 // logical host 124 #define COM_BITS_CTS (0) 127 #define begin_thread(p_thread, function, arg) 128 #define exit_thread(thread) 134 #define STATUS_WAIT_0 ((uint32_t)0x00000000L) 135 #define WAIT_OBJECT_0 ((STATUS_WAIT_0) + 0) 163 fd_set *__restrict __writefds,
fd_set *__restrict __exceptfds,
164 struct timeval *__restrict __timeout)
226 const struct sockaddr *to,
int tolen)
static int32_t _release_mutex(MUTEX *pmutex)
static int _com_set_state(int sock, COM_STATE *state)
static int socket(int af, int type, int protocol)
static int32_t _lock_mutex(MUTEX *pmutex, uint32_t timeout)
static int sendto(SOCKET s, const char *buf, int len, int flags, const struct sockaddr *to, int tolen)
static int32_t _wait_event_multi(EVENT **pevt, uint32_t count, uint32_t timeout, int wait_all)
static int32_t _com_clear(int sock, uint32_t timeout)
static int _socket_close(int sock)
static int _com_get_state(int sock, COM_STATE *state)
static int32_t _reset_event(EVENT *pevt)
static SOCKET accept(SOCKET s, struct sockaddr *addr, int *addrlen)
SOCKET fd_array[FD_SETSIZE]
static int32_t _initialize_mutex(MUTEX *pmutex)
static int _com_send(int sock, const char *buf, uint32_t len_send, uint32_t *len_sended, void *arg)
static int32_t _com_set_timeout(int sock, uint32_t timeout)
static uint32_t htonl(uint32_t hostlong)
static int _com_recv(int sock, char *buf, uint32_t len_recv, uint32_t *len_recved, uint32_t timeout, void *arg)
static int recvfrom(SOCKET s, char *buf, int len, int flags, struct sockaddr *from, int *fromlen)
static uint32_t _gettimeofday_msec()
static int send(SOCKET s, const char *buf, int len, int flags)
static uint32_t inet_addr(const char *addr)
static int bind(SOCKET s, const struct sockaddr *name, int namelen)
struct in_addr * LPIN_ADDR
struct in_addr * PIN_ADDR
static int32_t _tcp_set_keepalive(int sock, int enable, uint32_t idle, uint32_t interval, uint32_t count)
static int32_t _com_open(const void *com_param, int *sock)
static int32_t _create_event(EVENT *pevt, int reset_mode, int init_signal)
static int _com_close(int sock)
static uint16_t htons(uint16_t hostshort)
static int32_t _destroy_event(EVENT *pevt)
static int _com_get_modem_state(int sock, uint32_t *state)
static int32_t _wait_event(EVENT *pevt, uint32_t timeout)
static int setsockopt(SOCKET s, int level, int optname, const char *optval, int optlen)
static int32_t _socket_bind(const void *param, int *sock)
static int select(int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, struct timeval *__restrict __timeout)
static int recv(SOCKET s, char *buf, int len, int flags)
static int listen(SOCKET s, int backlog)
static int32_t _unlock_mutex(MUTEX *pmutex)
static int32_t _set_event(EVENT *pevt)
static int connect(SOCKET s, const struct sockaddr *name, int namelen)