net.h (666B)
1 /* 2 * Copy me if you can. 3 * by 20h 4 */ 5 6 #ifndef __NET_H__ 7 #define __NET_H__ 8 9 typedef struct net_t net_t; 10 struct net_t { 11 int fd; 12 13 char *net; 14 char *addr; 15 char *service; 16 char *options; 17 int type; 18 19 void *data[2]; 20 }; 21 22 net_t *net_new(char *desc); 23 void net_free(net_t *net); 24 25 int net_getnetname(char *str); 26 int net_addssl(net_t *net); 27 int net_connect(net_t *net); 28 void net_close(net_t *net); 29 int net_write(net_t *net, char *buf, int len); 30 int net_writeall(net_t *net, char *buf, int len); 31 int net_printf(net_t *net, char *fmt, ...); 32 int net_read(net_t *net, char *buf, int len); 33 int net_readall(net_t *net, char *buf, int len); 34 35 char *net_gets(net_t *net); 36 37 #endif 38