1
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
57
58
59
60
61
65
66
67
68
69
70
71
72
73
83
84
85
92
93
94
95
96
97
98
99
100
101
102
104
105
106
107
108
109
110
111
113
114
115
116
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
142
145
146
147
148
149
150
151
152
153
159
160
161
165
166
167
168
169
170
171
172
173
174
175
/* ... */
/* ... */
#ifndef LWIP_HDR_SOCKETS_PRIV_H
#define LWIP_HDR_SOCKETS_PRIV_H
#include "lwip/opt.h"
#if LWIP_SOCKET
#include "lwip/err.h"
#include "lwip/sockets.h"
#include "lwip/sys.h"
#ifdef __cplusplus
extern "C" {
#endif
#define NUM_SOCKETS MEMP_NUM_NETCONN
/* ... */
#ifndef SELWAIT_T
#define SELWAIT_T u8_t
#endif
union lwip_sock_lastdata {
struct netbuf *netbuf;
struct pbuf *pbuf;
...};
struct lwip_sock {
struct netconn *conn;
union lwip_sock_lastdata lastdata;
#if LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL
/* ... */
s16_t rcvevent;
/* ... */
u16_t sendevent;
u16_t errevent;
SELWAIT_T select_waiting;/* ... */
#endif
#if LWIP_NETCONN_FULLDUPLEX
u8_t fd_used;
u8_t fd_free_pending;
#define LWIP_SOCK_FD_FREE_TCP 1
#define LWIP_SOCK_FD_FREE_FREE 2
/* ... */#endif
...};
#ifndef set_errno
#define set_errno(err) do { if (err) { errno = (err); } } while(0)
#endif
#if !LWIP_TCPIP_CORE_LOCKING
#define LWIP_SETGETSOCKOPT_MAXOPTLEN LWIP_MAX(16, sizeof(struct ifreq))
/* ... */
struct lwip_setgetsockopt_data {
int s;
int level;
int optname;
/* ... */
#if LWIP_MPU_COMPATIBLE
u8_t optval[LWIP_SETGETSOCKOPT_MAXOPTLEN];
#else
union {
void *p;
const void *pc;
...} optval;/* ... */
#endif
socklen_t optlen;
int err;
void* completed_sem;
...};/* ... */
#endif
#ifdef __cplusplus
}extern "C" { ... }
#endif
struct lwip_sock* lwip_socket_dbg_get_socket(int fd);
#if LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL
#if LWIP_NETCONN_SEM_PER_THREAD
#define SELECT_SEM_T sys_sem_t*
#define SELECT_SEM_PTR(sem) (sem)
/* ... */#else
#define SELECT_SEM_T sys_sem_t
#define SELECT_SEM_PTR(sem) (&(sem))
/* ... */#endif
struct lwip_select_cb {
struct lwip_select_cb *next;
struct lwip_select_cb *prev;
#if LWIP_SOCKET_SELECT
fd_set *readset;
fd_set *writeset;
fd_set *exceptset;/* ... */
#endif
#if LWIP_SOCKET_POLL
struct pollfd *poll_fds;
nfds_t poll_nfds;/* ... */
#endif
int sem_signalled;
SELECT_SEM_T sem;
...};/* ... */
#endif
/* ... */
#endif
/* ... */
#endif