00001
00023 #ifndef POLARSSL_NET_H
00024 #define POLARSSL_NET_H
00025
00026 #define POLARSSL_ERR_NET_UNKNOWN_HOST -0x0F00
00027 #define POLARSSL_ERR_NET_SOCKET_FAILED -0x0F10
00028 #define POLARSSL_ERR_NET_CONNECT_FAILED -0x0F20
00029 #define POLARSSL_ERR_NET_BIND_FAILED -0x0F30
00030 #define POLARSSL_ERR_NET_LISTEN_FAILED -0x0F40
00031 #define POLARSSL_ERR_NET_ACCEPT_FAILED -0x0F50
00032 #define POLARSSL_ERR_NET_RECV_FAILED -0x0F60
00033 #define POLARSSL_ERR_NET_SEND_FAILED -0x0F70
00034 #define POLARSSL_ERR_NET_CONN_RESET -0x0F80
00035 #define POLARSSL_ERR_NET_TRY_AGAIN -0x0F90
00036
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040
00053 int net_connect( int *fd, char *host, int port );
00054
00068 int net_bind( int *fd, char *bind_ip, int port );
00069
00081 int net_accept( int bind_fd, int *client_fd, void *client_ip );
00082
00090 int net_set_block( int fd );
00091
00099 int net_set_nonblock( int fd );
00100
00109 void net_usleep( unsigned long usec );
00110
00123 int net_recv( void *ctx, unsigned char *buf, int len );
00124
00137 int net_send( void *ctx, unsigned char *buf, int len );
00138
00144 void net_close( int fd );
00145
00146 #ifdef __cplusplus
00147 }
00148 #endif
00149
00150 #endif