PolarSSL v1.1.4
|
00001 00027 #ifndef POLARSSL_NET_H 00028 #define POLARSSL_NET_H 00029 00030 #include <string.h> 00031 00032 #define POLARSSL_ERR_NET_UNKNOWN_HOST -0x0040 00033 #define POLARSSL_ERR_NET_SOCKET_FAILED -0x0042 00034 #define POLARSSL_ERR_NET_CONNECT_FAILED -0x0044 00035 #define POLARSSL_ERR_NET_BIND_FAILED -0x0046 00036 #define POLARSSL_ERR_NET_LISTEN_FAILED -0x0048 00037 #define POLARSSL_ERR_NET_ACCEPT_FAILED -0x004A 00038 #define POLARSSL_ERR_NET_RECV_FAILED -0x004C 00039 #define POLARSSL_ERR_NET_SEND_FAILED -0x004E 00040 #define POLARSSL_ERR_NET_CONN_RESET -0x0050 00041 #define POLARSSL_ERR_NET_WANT_READ -0x0052 00042 #define POLARSSL_ERR_NET_WANT_WRITE -0x0054 00044 #define POLARSSL_NET_LISTEN_BACKLOG 10 00046 #ifdef __cplusplus 00047 extern "C" { 00048 #endif 00049 00062 int net_connect( int *fd, const char *host, int port ); 00063 00077 int net_bind( int *fd, const char *bind_ip, int port ); 00078 00090 int net_accept( int bind_fd, int *client_fd, void *client_ip ); 00091 00099 int net_set_block( int fd ); 00100 00108 int net_set_nonblock( int fd ); 00109 00118 void net_usleep( unsigned long usec ); 00119 00132 int net_recv( void *ctx, unsigned char *buf, size_t len ); 00133 00146 int net_send( void *ctx, const unsigned char *buf, size_t len ); 00147 00153 void net_close( int fd ); 00154 00155 #ifdef __cplusplus 00156 } 00157 #endif 00158 00159 #endif /* net.h */