1 /*
2  * Copyright (C) 2019-2020 Alibaba Group Holding Limited
3  */
4 
5 #ifndef __NETWORK_H__
6 #define __NETWORK_H__
7 
8 #include <sys/socket.h>
9 #include <arpa/inet.h>
10 #include <lwip/netdb.h>
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 typedef struct network {
17     int fd;
18     struct sockaddr_in address;
19     int (*net_connect)(struct network *n, char *addr, int port, int net_type);
20     int (*net_read)(struct network *, unsigned char *, int, int);
21     int (*net_write)(struct network *, unsigned char *, int, int);
22     void (*net_disconncet)(struct network *n);
23 } network_t;
24 
25 void rws_net_init(network_t *n);
26 
27 #ifdef __cplusplus
28 }
29 #endif
30 #endif