User own API file. More...
Go to the source code of this file.
Classes | |
struct | fd_set |
struct | in_addr |
struct | sockaddr |
struct | sockaddr_in |
struct | timeval |
Defines | |
#define | _E_BUSY_PROC (-1) |
#define | AF_INET (2) /* internetwork: UDP, TCP, etc. */ |
#define | begin_thread(p_thread, function, arg) |
A macro that begins thread. | |
#define | COM_BITS_CTS (0) |
A definition for CTS flag. | |
#define | dn_sleep(n) |
A macro that sleeps. | |
#define | DNGetLastError() (-1) |
A macro that gets last OS error. | |
#define | exit_thread(thread) |
A macro that ends thread. | |
#define | F_GETFL (3) /* Get file status flags. */ |
#define | F_SETFL (4) /* Set file status flags. */ |
#define | FD_SET(fd, fdsetp) |
#define | FD_SETSIZE (64) |
#define | FD_ZERO(fdsetp) |
#define | INADDR_ANY ((uint32_t)0x00000000) |
#define | INADDR_NONE (0xffffffff) |
#define | IPPROTO_TCP (6) /* tcp */ |
#define | MSG_PEEK (0x02) |
#define | O_NONBLOCK (04000) |
#define | OSFAILED(ret) ((ret) == -1) |
A macro that returns TRUE/FALSE. If ret is OS failed, then returns TRUE. | |
#define | OSSUCCEEDED(ret) ((ret) == 0) |
A macro that returns TRUE/FALSE. If ret is OS succeeded, then returns TRUE. | |
#define | s_addr S_un.S_addr /* can be used for most tcp & ip code */ |
#define | s_host S_un.S_un_b.s_b2 |
#define | s_imp S_un.S_un_w.s_w2 |
#define | s_impno S_un.S_un_b.s_b4 |
#define | s_lh S_un.S_un_b.s_b3 |
#define | s_net S_un.S_un_b.s_b1 |
#define | SO_KEEPALIVE (0x0008) /* keep connections alive */ |
#define | SO_RCVTIMEO (0x1006) /* receive timeout */ |
#define | SO_REUSEADDR (0x0004) /* allow local address reuse */ |
#define | SO_SNDTIMEO (0x1005) /* send timeout */ |
#define | SOCK_DGRAM (2) /* datagram socket */ |
#define | SOCK_STREAM (1) /* stream socket */ |
#define | SOCKET uint16_t |
#define | SOL_SOCKET (0xffff) /* options for socket level */ |
#define | STATUS_WAIT_0 ((uint32_t)0x00000000L) |
#define | TCP_NODELAY (0x0001) |
#define | THRET void |
#define | THTYPE |
#define | WAIT_OBJECT_0 ((STATUS_WAIT_0) + 0) |
Typedefs | |
typedef int | COM_STATE |
typedef int | EVENT |
typedef struct fd_set | fd_set |
typedef struct in_addr | IN_ADDR |
typedef struct in_addr * | LPIN_ADDR |
typedef int | MUTEX |
typedef struct in_addr * | PIN_ADDR |
typedef int | socklen_t |
typedef int | THREAD |
Functions | |
static int32_t | _com_clear (int sock, uint32_t timeout) |
static int | _com_close (int sock) |
static int | _com_get_modem_state (int sock, uint32_t *state) |
static int | _com_get_state (int sock, COM_STATE *state) |
static int32_t | _com_open (const void *com_param, int *sock) |
static int | _com_recv (int sock, char *buf, uint32_t len_recv, uint32_t *len_recved, uint32_t timeout, void *arg) |
static int | _com_send (int sock, const char *buf, uint32_t len_send, uint32_t *len_sended, void *arg) |
static int | _com_set_state (int sock, COM_STATE *state) |
static int32_t | _com_set_timeout (int sock, uint32_t timeout) |
static int32_t | _create_event (EVENT *pevt, int reset_mode, int init_signal) |
static int32_t | _destroy_event (EVENT *pevt) |
static uint32_t | _gettimeofday_msec () |
static int32_t | _initialize_mutex (MUTEX *pmutex) |
static int32_t | _lock_mutex (MUTEX *pmutex, uint32_t timeout) |
static int32_t | _release_mutex (MUTEX *pmutex) |
static int32_t | _reset_event (EVENT *pevt) |
static int32_t | _set_event (EVENT *pevt) |
static int32_t | _socket_bind (const void *param, int *sock) |
static int | _socket_close (int sock) |
static int32_t | _tcp_set_keepalive (int sock, int enable, uint32_t idle, uint32_t interval, uint32_t count) |
static int32_t | _unlock_mutex (MUTEX *pmutex) |
static int32_t | _wait_event (EVENT *pevt, uint32_t timeout) |
static int32_t | _wait_event_multi (EVENT **pevt, uint32_t count, uint32_t timeout, int wait_all) |
static SOCKET | accept (SOCKET s, struct sockaddr *addr, int *addrlen) |
static int | bind (SOCKET s, const struct sockaddr *name, int namelen) |
static int | connect (SOCKET s, const struct sockaddr *name, int namelen) |
static uint32_t | htonl (uint32_t hostlong) |
static uint16_t | htons (uint16_t hostshort) |
static uint32_t | inet_addr (const char *addr) |
static int | listen (SOCKET s, int backlog) |
static int | recv (SOCKET s, char *buf, int len, int flags) |
static int | recvfrom (SOCKET s, char *buf, int len, int flags, struct sockaddr *from, int *fromlen) |
static int | select (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, struct timeval *__restrict __timeout) |
static int | send (SOCKET s, const char *buf, int len, int flags) |
static int | sendto (SOCKET s, const char *buf, int len, int flags, const struct sockaddr *to, int tolen) |
static int | setsockopt (SOCKET s, int level, int optname, const char *optval, int optlen) |
static int | socket (int af, int type, int protocol) |
User own API file.
You can define some additional APIs.
Software License Agreement (MIT License)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Definition in file dn_additional.h.
#define _E_BUSY_PROC (-1) |
Definition at line 64 of file dn_additional.h.
#define AF_INET (2) /* internetwork: UDP, TCP, etc. */ |
Definition at line 66 of file dn_additional.h.
#define begin_thread | ( | p_thread, | |
function, | |||
arg | |||
) |
A macro that begins thread.
[in] | p_thread | The pointer of thread handle: THREAD. |
[in] | function | The thread function. |
[in] | arg | The argument of thread function. |
#define COM_BITS_CTS (0) |
A definition for CTS flag.
#define dn_sleep | ( | n | ) |
A macro that sleeps.
[in] | n | The sleep time[ms]. |
#define DNGetLastError | ( | ) | (-1) |
A macro that gets last OS error.
#define exit_thread | ( | thread | ) |
A macro that ends thread.
[in] | thread | The thread handle: THREAD. |
#define F_GETFL (3) /* Get file status flags. */ |
Definition at line 81 of file dn_additional.h.
#define F_SETFL (4) /* Set file status flags. */ |
Definition at line 82 of file dn_additional.h.
#define FD_SET | ( | fd, | |
fdsetp | |||
) |
Definition at line 51 of file dn_additional.h.
#define FD_SETSIZE (64) |
Definition at line 42 of file dn_additional.h.
#define FD_ZERO | ( | fdsetp | ) |
Definition at line 52 of file dn_additional.h.
#define INADDR_ANY ((uint32_t)0x00000000) |
Definition at line 36 of file dn_additional.h.
#define INADDR_NONE (0xffffffff) |
Definition at line 37 of file dn_additional.h.
#define IPPROTO_TCP (6) /* tcp */ |
Definition at line 76 of file dn_additional.h.
#define MSG_PEEK (0x02) |
Definition at line 79 of file dn_additional.h.
#define O_NONBLOCK (04000) |
Definition at line 83 of file dn_additional.h.
#define OSFAILED | ( | ret | ) | ((ret) == -1) |
A macro that returns TRUE/FALSE. If ret is OS failed, then returns TRUE.
#define OSSUCCEEDED | ( | ret | ) | ((ret) == 0) |
A macro that returns TRUE/FALSE. If ret is OS succeeded, then returns TRUE.
#define s_addr S_un.S_addr /* can be used for most tcp & ip code */ |
Definition at line 100 of file dn_additional.h.
#define s_host S_un.S_un_b.s_b2 |
Definition at line 101 of file dn_additional.h.
#define s_imp S_un.S_un_w.s_w2 |
Definition at line 103 of file dn_additional.h.
#define s_impno S_un.S_un_b.s_b4 |
Definition at line 104 of file dn_additional.h.
#define s_lh S_un.S_un_b.s_b3 |
Definition at line 105 of file dn_additional.h.
#define s_net S_un.S_un_b.s_b1 |
Definition at line 102 of file dn_additional.h.
#define SO_KEEPALIVE (0x0008) /* keep connections alive */ |
Definition at line 72 of file dn_additional.h.
#define SO_RCVTIMEO (0x1006) /* receive timeout */ |
Definition at line 74 of file dn_additional.h.
#define SO_REUSEADDR (0x0004) /* allow local address reuse */ |
Definition at line 71 of file dn_additional.h.
#define SO_SNDTIMEO (0x1005) /* send timeout */ |
Definition at line 73 of file dn_additional.h.
#define SOCK_DGRAM (2) /* datagram socket */ |
Definition at line 68 of file dn_additional.h.
#define SOCK_STREAM (1) /* stream socket */ |
Definition at line 67 of file dn_additional.h.
Definition at line 39 of file dn_additional.h.
#define SOL_SOCKET (0xffff) /* options for socket level */ |
Definition at line 70 of file dn_additional.h.
#define STATUS_WAIT_0 ((uint32_t)0x00000000L) |
Definition at line 134 of file dn_additional.h.
#define TCP_NODELAY (0x0001) |
Definition at line 77 of file dn_additional.h.
#define THRET void |
Definition at line 132 of file dn_additional.h.
#define THTYPE |
Definition at line 133 of file dn_additional.h.
#define WAIT_OBJECT_0 ((STATUS_WAIT_0) + 0) |
Definition at line 135 of file dn_additional.h.
typedef int COM_STATE |
Definition at line 125 of file dn_additional.h.
typedef int EVENT |
Definition at line 136 of file dn_additional.h.
typedef int MUTEX |
Definition at line 130 of file dn_additional.h.
typedef int socklen_t |
Definition at line 122 of file dn_additional.h.
typedef int THREAD |
Definition at line 131 of file dn_additional.h.
static int32_t _com_clear | ( | int | sock, |
uint32_t | timeout | ||
) | [static] |
Definition at line 283 of file dn_additional.h.
static int _com_close | ( | int | sock | ) | [static] |
Definition at line 257 of file dn_additional.h.
static int _com_get_modem_state | ( | int | sock, |
uint32_t * | state | ||
) | [static] |
Definition at line 301 of file dn_additional.h.
static int _com_get_state | ( | int | sock, |
COM_STATE * | state | ||
) | [static] |
Definition at line 289 of file dn_additional.h.
Definition at line 251 of file dn_additional.h.
static int _com_recv | ( | int | sock, |
char * | buf, | ||
uint32_t | len_recv, | ||
uint32_t * | len_recved, | ||
uint32_t | timeout, | ||
void * | arg | ||
) | [static] |
Definition at line 270 of file dn_additional.h.
static int _com_send | ( | int | sock, |
const char * | buf, | ||
uint32_t | len_send, | ||
uint32_t * | len_sended, | ||
void * | arg | ||
) | [static] |
Definition at line 263 of file dn_additional.h.
static int _com_set_state | ( | int | sock, |
COM_STATE * | state | ||
) | [static] |
Definition at line 295 of file dn_additional.h.
static int32_t _com_set_timeout | ( | int | sock, |
uint32_t | timeout | ||
) | [static] |
Definition at line 277 of file dn_additional.h.
static int32_t _create_event | ( | EVENT * | pevt, |
int | reset_mode, | ||
int | init_signal | ||
) | [static] |
Definition at line 331 of file dn_additional.h.
static int32_t _destroy_event | ( | EVENT * | pevt | ) | [static] |
Definition at line 337 of file dn_additional.h.
static uint32_t _gettimeofday_msec | ( | ) | [static] |
Definition at line 368 of file dn_additional.h.
static int32_t _initialize_mutex | ( | MUTEX * | pmutex | ) | [static] |
Definition at line 307 of file dn_additional.h.
static int32_t _lock_mutex | ( | MUTEX * | pmutex, |
uint32_t | timeout | ||
) | [static] |
Definition at line 319 of file dn_additional.h.
static int32_t _release_mutex | ( | MUTEX * | pmutex | ) | [static] |
Definition at line 313 of file dn_additional.h.
static int32_t _reset_event | ( | EVENT * | pevt | ) | [static] |
Definition at line 349 of file dn_additional.h.
static int32_t _set_event | ( | EVENT * | pevt | ) | [static] |
Definition at line 343 of file dn_additional.h.
static int32_t _socket_bind | ( | const void * | param, |
int * | sock | ||
) | [static] |
Definition at line 245 of file dn_additional.h.
static int _socket_close | ( | int | sock | ) | [static] |
Definition at line 239 of file dn_additional.h.
static int32_t _tcp_set_keepalive | ( | int | sock, |
int | enable, | ||
uint32_t | idle, | ||
uint32_t | interval, | ||
uint32_t | count | ||
) | [static] |
Definition at line 218 of file dn_additional.h.
static int32_t _unlock_mutex | ( | MUTEX * | pmutex | ) | [static] |
Definition at line 325 of file dn_additional.h.
static int32_t _wait_event | ( | EVENT * | pevt, |
uint32_t | timeout | ||
) | [static] |
Definition at line 355 of file dn_additional.h.
static int32_t _wait_event_multi | ( | EVENT ** | pevt, |
uint32_t | count, | ||
uint32_t | timeout, | ||
int | wait_all | ||
) | [static] |
Definition at line 361 of file dn_additional.h.
Definition at line 200 of file dn_additional.h.
Definition at line 176 of file dn_additional.h.
Definition at line 188 of file dn_additional.h.
Definition at line 150 of file dn_additional.h.
Definition at line 144 of file dn_additional.h.
Definition at line 156 of file dn_additional.h.
Definition at line 194 of file dn_additional.h.
Definition at line 212 of file dn_additional.h.
static int recvfrom | ( | SOCKET | s, |
char * | buf, | ||
int | len, | ||
int | flags, | ||
struct sockaddr * | from, | ||
int * | fromlen | ||
) | [static] |
Definition at line 232 of file dn_additional.h.
static int select | ( | int | __nfds, |
fd_set *__restrict | __readfds, | ||
fd_set *__restrict | __writefds, | ||
fd_set *__restrict | __exceptfds, | ||
struct timeval *__restrict | __timeout | ||
) | [static] |
Definition at line 162 of file dn_additional.h.
Definition at line 206 of file dn_additional.h.
static int sendto | ( | SOCKET | s, |
const char * | buf, | ||
int | len, | ||
int | flags, | ||
const struct sockaddr * | to, | ||
int | tolen | ||
) | [static] |
Definition at line 225 of file dn_additional.h.
static int setsockopt | ( | SOCKET | s, |
int | level, | ||
int | optname, | ||
const char * | optval, | ||
int | optlen | ||
) | [static] |
Definition at line 182 of file dn_additional.h.
static int socket | ( | int | af, |
int | type, | ||
int | protocol | ||
) | [static] |
Definition at line 170 of file dn_additional.h.