dn_additional.h
Go to the documentation of this file.
1 #ifndef DN_ADDITIONAL_H_
2 #define DN_ADDITIONAL_H_
3 
36 #define INADDR_ANY ((uint32_t)0x00000000)
37 #define INADDR_NONE (0xffffffff)
38 
39 #define SOCKET uint16_t
40 
41 #ifndef FD_SETSIZE
42 #define FD_SETSIZE (64)
43 #endif /* FD_SETSIZE */
44 
45 typedef struct fd_set
46 {
47  uint16_t fd_count; /* how many are SET? */
48  SOCKET fd_array[FD_SETSIZE]; /* an array of SOCKETs */
49 } fd_set;
50 
51 #define FD_SET(fd, fdsetp)
52 #define FD_ZERO(fdsetp)
53 
54 struct timeval
55 {
56  long tv_sec; /* seconds */
57  long tv_usec; /* and microseconds */
58 };
59 
60 #define DNGetLastError() (-1)
61 #define OSSUCCEEDED(ret) ((ret) == 0)
62 #define OSFAILED(ret) ((ret) == -1)
63 
64 #define _E_BUSY_PROC (-1)
65 
66 #define AF_INET (2) /* internetwork: UDP, TCP, etc. */
67 #define SOCK_STREAM (1) /* stream socket */
68 #define SOCK_DGRAM (2) /* datagram socket */
69 
70 #define SOL_SOCKET (0xffff) /* options for socket level */
71 #define SO_REUSEADDR (0x0004) /* allow local address reuse */
72 #define SO_KEEPALIVE (0x0008) /* keep connections alive */
73 #define SO_SNDTIMEO (0x1005) /* send timeout */
74 #define SO_RCVTIMEO (0x1006) /* receive timeout */
75 
76 #define IPPROTO_TCP (6) /* tcp */
77 #define TCP_NODELAY (0x0001)
78 
79 #define MSG_PEEK (0x02)
80 
81 #define F_GETFL (3) /* Get file status flags. */
82 #define F_SETFL (4) /* Set file status flags. */
83 #define O_NONBLOCK (04000)
84 
85 typedef struct in_addr
86 {
87  union
88  {
89  struct
90  {
91  uint8_t s_b1, s_b2, s_b3, s_b4;
92  } S_un_b;
93  struct
94  {
95  uint16_t s_w1, s_w2;
96  } S_un_w;
98  } S_un;
99 
100 #define s_addr S_un.S_addr /* can be used for most tcp & ip code */
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
107 
109 {
110  short sin_family;
112  struct in_addr sin_addr;
113  char sin_zero[8];
114 };
115 
116 struct sockaddr
117 {
118  uint16_t sa_family; /* address family */
119  char sa_data[14]; /* up to 14 bytes of direct address */
120 };
121 
122 typedef int socklen_t;
123 
124 #define COM_BITS_CTS (0)
125 typedef int COM_STATE;
126 
127 #define begin_thread(p_thread, function, arg)
128 #define exit_thread(thread)
129 #define dn_sleep(n)
130 typedef int MUTEX;
131 typedef int THREAD;
132 #define THRET void
133 #define THTYPE
134 #define STATUS_WAIT_0 ((uint32_t)0x00000000L)
135 #define WAIT_OBJECT_0 ((STATUS_WAIT_0) + 0)
136 typedef int EVENT;
137 
138 #ifdef __cplusplus
139 extern "C"
140 {
141 #endif
142 
143  static uint16_t
144  htons(uint16_t hostshort)
145  {
146  return 0;
147  }
148 
149  static uint32_t
150  htonl(uint32_t hostlong)
151  {
152  return 0;
153  }
154 
155  static uint32_t
156  inet_addr(const char *addr)
157  {
158  return 0;
159  }
160 
161  static int
162  select(int __nfds, fd_set *__restrict __readfds,
163  fd_set *__restrict __writefds, fd_set *__restrict __exceptfds,
164  struct timeval *__restrict __timeout)
165  {
166  return -1;
167  }
168 
169  static int
170  socket(int af, int type, int protocol)
171  {
172  return -1;
173  }
174 
175  static int
176  bind(SOCKET s, const struct sockaddr *name, int namelen)
177  {
178  return -1;
179  }
180 
181  static int
182  setsockopt(SOCKET s, int level, int optname, const char *optval, int optlen)
183  {
184  return -1;
185  }
186 
187  static int
188  connect(SOCKET s, const struct sockaddr *name, int namelen)
189  {
190  return -1;
191  }
192 
193  static int
194  listen(SOCKET s, int backlog)
195  {
196  return -1;
197  }
198 
199  static SOCKET
200  accept(SOCKET s, struct sockaddr *addr, int *addrlen)
201  {
202  return -1;
203  }
204 
205  static int
206  send(SOCKET s, const char *buf, int len, int flags)
207  {
208  return -1;
209  }
210 
211  static int
212  recv(SOCKET s, char *buf, int len, int flags)
213  {
214  return -1;
215  }
216 
217  static int32_t
218  _tcp_set_keepalive(int sock, int enable, uint32_t idle, uint32_t interval,
219  uint32_t count)
220  {
221  return -1;
222  }
223 
224  static int
225  sendto(SOCKET s, const char *buf, int len, int flags,
226  const struct sockaddr *to, int tolen)
227  {
228  return -1;
229  }
230 
231  static int
232  recvfrom(SOCKET s, char *buf, int len, int flags, struct sockaddr *from,
233  int *fromlen)
234  {
235  return -1;
236  }
237 
238  static int
239  _socket_close(int sock)
240  {
241  return -1;
242  }
243 
244  static int32_t
245  _socket_bind(const void *param, int *sock)
246  {
247  return -1;
248  }
249 
250  static int32_t
251  _com_open(const void *com_param, int *sock)
252  {
253  return -1;
254  }
255 
256  static int
257  _com_close(int sock)
258  {
259  return -1;
260  }
261 
262  static int
263  _com_send(int sock, const char *buf, uint32_t len_send, uint32_t *len_sended,
264  void *arg)
265  {
266  return -1;
267  }
268 
269  static int
270  _com_recv(int sock, char *buf, uint32_t len_recv, uint32_t *len_recved,
271  uint32_t timeout, void *arg)
272  {
273  return -1;
274  }
275 
276  static int32_t
277  _com_set_timeout(int sock, uint32_t timeout)
278  {
279  return -1;
280  }
281 
282  static int32_t
283  _com_clear(int sock, uint32_t timeout)
284  {
285  return -1;
286  }
287 
288  static int
289  _com_get_state(int sock, COM_STATE *state)
290  {
291  return -1;
292  }
293 
294  static int
295  _com_set_state(int sock, COM_STATE *state)
296  {
297  return -1;
298  }
299 
300  static int
301  _com_get_modem_state(int sock, uint32_t *state)
302  {
303  return -1;
304  }
305 
306  static int32_t
308  {
309  return -1;
310  }
311 
312  static int32_t
314  {
315  return -1;
316  }
317 
318  static int32_t
319  _lock_mutex(MUTEX *pmutex, uint32_t timeout)
320  {
321  return -1;
322  }
323 
324  static int32_t
326  {
327  return -1;
328  }
329 
330  static int32_t
331  _create_event(EVENT *pevt, int reset_mode, int init_signal)
332  {
333  return -1;
334  }
335 
336  static int32_t
338  {
339  return -1;
340  }
341 
342  static int32_t
344  {
345  return -1;
346  }
347 
348  static int32_t
350  {
351  return -1;
352  }
353 
354  static int32_t
355  _wait_event(EVENT *pevt, uint32_t timeout)
356  {
357  return -1;
358  }
359 
360  static int32_t
361  _wait_event_multi(EVENT **pevt, uint32_t count, uint32_t timeout,
362  int wait_all)
363  {
364  return -1;
365  }
366 
367  static uint32_t
369  {
370  return 0;
371  }
372 
373 
374 #ifdef __cplusplus
375 }
376 #endif
377 
378 #endif /* DN_ADDITIONAL_H_ */
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)
unsigned uint32_t
Definition: stdint.h:43
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)
uint16_t s_w2
Definition: dn_additional.h:95
long tv_sec
Definition: dn_additional.h:56
static int32_t _reset_event(EVENT *pevt)
static SOCKET accept(SOCKET s, struct sockaddr *addr, int *addrlen)
SOCKET fd_array[FD_SETSIZE]
Definition: dn_additional.h:48
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)
unsigned short uint16_t
Definition: stdint.h:41
unsigned char uint8_t
Definition: stdint.h:39
uint16_t sa_family
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)
int THREAD
#define SOCKET
Definition: dn_additional.h:39
int MUTEX
uint16_t fd_count
Definition: dn_additional.h:47
long tv_usec
Definition: dn_additional.h:57
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)
#define FD_SETSIZE
Definition: dn_additional.h:42
uint16_t sin_port
int COM_STATE
uint32_t S_addr
Definition: dn_additional.h:97
static int32_t _com_open(const void *com_param, int *sock)
static int32_t _create_event(EVENT *pevt, int reset_mode, int init_signal)
int socklen_t
struct fd_set fd_set
struct in_addr IN_ADDR
int EVENT
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)
int int32_t
Definition: stdint.h:42
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)
uint8_t s_b4
Definition: dn_additional.h:91
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)
short sin_family


bcap_core
Author(s): DENSO WAVE INCORPORATED
autogenerated on Mon Jun 10 2019 13:12:20