123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- #ifndef POLARSSL_NET_H
- #define POLARSSL_NET_H
- #include <string.h>
-
- #define POLARSSL_ERR_NET_UNKNOWN_HOST -0x0040
- #define POLARSSL_ERR_NET_SOCKET_FAILED -0x0042
- #define POLARSSL_ERR_NET_CONNECT_FAILED -0x0044
- #define POLARSSL_ERR_NET_BIND_FAILED -0x0046
- #define POLARSSL_ERR_NET_LISTEN_FAILED -0x0048
- #define POLARSSL_ERR_NET_ACCEPT_FAILED -0x004A
- #define POLARSSL_ERR_NET_RECV_FAILED -0x004C
- #define POLARSSL_ERR_NET_SEND_FAILED -0x004E
- #define POLARSSL_ERR_NET_CONN_RESET -0x0050
- #define POLARSSL_ERR_NET_WANT_READ -0x0052
- #define POLARSSL_ERR_NET_WANT_WRITE -0x0054
- #define POLARSSL_NET_LISTEN_BACKLOG 10
- #ifdef __cplusplus
- extern "C" {
- #endif
- int net_connect( int *fd, const char *host, int port );
- int net_bind( int *fd, const char *bind_ip, int port );
- int net_accept( int bind_fd, int *client_fd, void *client_ip );
- int net_set_block( int fd );
- int net_set_nonblock( int fd );
- void net_usleep( unsigned long usec );
- int net_recv( void *ctx, unsigned char *buf, size_t len );
- int net_send( void *ctx, const unsigned char *buf, size_t len );
- void net_close( int fd );
- #ifdef __cplusplus
- }
- #endif
- #endif
|