PolarSSL v1.2.7
net.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_NET_H
28 #define POLARSSL_NET_H
29 
30 #include <string.h>
31 
32 #define POLARSSL_ERR_NET_UNKNOWN_HOST -0x0056
33 #define POLARSSL_ERR_NET_SOCKET_FAILED -0x0042
34 #define POLARSSL_ERR_NET_CONNECT_FAILED -0x0044
35 #define POLARSSL_ERR_NET_BIND_FAILED -0x0046
36 #define POLARSSL_ERR_NET_LISTEN_FAILED -0x0048
37 #define POLARSSL_ERR_NET_ACCEPT_FAILED -0x004A
38 #define POLARSSL_ERR_NET_RECV_FAILED -0x004C
39 #define POLARSSL_ERR_NET_SEND_FAILED -0x004E
40 #define POLARSSL_ERR_NET_CONN_RESET -0x0050
41 #define POLARSSL_ERR_NET_WANT_READ -0x0052
42 #define POLARSSL_ERR_NET_WANT_WRITE -0x0054
44 #define POLARSSL_NET_LISTEN_BACKLOG 10
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
62 int net_connect( int *fd, const char *host, int port );
63 
77 int net_bind( int *fd, const char *bind_ip, int port );
78 
90 int net_accept( int bind_fd, int *client_fd, void *client_ip );
91 
99 int net_set_block( int fd );
100 
108 int net_set_nonblock( int fd );
109 
118 void net_usleep( unsigned long usec );
119 
132 int net_recv( void *ctx, unsigned char *buf, size_t len );
133 
146 int net_send( void *ctx, const unsigned char *buf, size_t len );
147 
153 void net_close( int fd );
154 
155 #ifdef __cplusplus
156 }
157 #endif
158 
159 #endif /* net.h */