00001 00004 #ifndef XYSSL_NET_H 00005 #define XYSSL_NET_H 00006 00007 #define XYSSL_ERR_NET_UNKNOWN_HOST -0x0F00 00008 #define XYSSL_ERR_NET_SOCKET_FAILED -0x0F10 00009 #define XYSSL_ERR_NET_CONNECT_FAILED -0x0F20 00010 #define XYSSL_ERR_NET_BIND_FAILED -0x0F30 00011 #define XYSSL_ERR_NET_LISTEN_FAILED -0x0F40 00012 #define XYSSL_ERR_NET_ACCEPT_FAILED -0x0F50 00013 #define XYSSL_ERR_NET_RECV_FAILED -0x0F60 00014 #define XYSSL_ERR_NET_SEND_FAILED -0x0F70 00015 #define XYSSL_ERR_NET_CONN_RESET -0x0F80 00016 #define XYSSL_ERR_NET_TRY_AGAIN -0x0F90 00017 00018 #ifdef __cplusplus 00019 extern "C" { 00020 #endif 00021 00030 int net_connect( int *fd, char *host, int port ); 00031 00041 int net_bind( int *fd, char *bind_ip, int port ); 00042 00050 int net_accept( int bind_fd, int *client_fd, void *client_ip ); 00051 00057 int net_set_block( int fd ); 00058 00064 int net_set_nonblock( int fd ); 00065 00072 void net_usleep( unsigned long usec ); 00073 00082 int net_recv( void *ctx, unsigned char *buf, int len ); 00083 00092 int net_send( void *ctx, unsigned char *buf, int len ); 00093 00097 void net_close( int fd ); 00098 00099 #ifdef __cplusplus 00100 } 00101 #endif 00102 00103 #endif /* net.h */