sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
Loading...
Searching...
No Matches
sockets_priv.h
Go to the documentation of this file.
1
6
7
/*
8
* Copyright (c) 2017 Joel Cunningham, Garmin International, Inc. <joel.cunningham@garmin.com>
9
* All rights reserved.
10
*
11
* Redistribution and use in source and binary forms, with or without modification,
12
* are permitted provided that the following conditions are met:
13
*
14
* 1. Redistributions of source code must retain the above copyright notice,
15
* this list of conditions and the following disclaimer.
16
* 2. Redistributions in binary form must reproduce the above copyright notice,
17
* this list of conditions and the following disclaimer in the documentation
18
* and/or other materials provided with the distribution.
19
* 3. The name of the author may not be used to endorse or promote products
20
* derived from this software without specific prior written permission.
21
*
22
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
23
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
25
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
31
* OF SUCH DAMAGE.
32
*
33
* This file is part of the lwIP TCP/IP stack.
34
*
35
* Author: Joel Cunningham <joel.cunningham@me.com>
36
*
37
*/
38
#ifndef LWIP_HDR_SOCKETS_PRIV_H
39
#define LWIP_HDR_SOCKETS_PRIV_H
40
41
#include "
lwip/opt.h
"
42
43
#if LWIP_SOCKET
/* don't build if not configured for use in lwipopts.h */
44
45
#include "
lwip/err.h
"
46
#include "
lwip/sockets.h
"
47
#include "
lwip/sys.h
"
48
49
#ifdef __cplusplus
50
extern
"C"
{
51
#endif
52
53
#define NUM_SOCKETS MEMP_NUM_NETCONN
54
58
#ifndef SELWAIT_T
59
#define SELWAIT_T u8_t
60
#endif
61
62
union
lwip_sock_lastdata {
63
struct
netbuf *netbuf;
64
struct
pbuf *pbuf;
65
};
66
68
struct
lwip_sock {
70
struct
netconn *conn;
72
union
lwip_sock_lastdata lastdata;
73
#if LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL
76
s16_t rcvevent;
79
u16_t sendevent;
81
u16_t errevent;
83
SELWAIT_T select_waiting;
84
#endif
/* LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL */
85
#if LWIP_NETCONN_FULLDUPLEX
86
/* counter of how many threads are using a struct lwip_sock (not the 'int') */
87
u8_t fd_used;
88
/* status of pending close/delete actions */
89
u8_t fd_free_pending;
90
#define LWIP_SOCK_FD_FREE_TCP 1
91
#define LWIP_SOCK_FD_FREE_FREE 2
92
#endif
93
};
94
95
#ifndef set_errno
96
#define set_errno(err) do { if (err) { errno = (err); } } while(0)
97
#endif
98
99
#if !LWIP_TCPIP_CORE_LOCKING
101
#define LWIP_SETGETSOCKOPT_MAXOPTLEN LWIP_MAX(16, sizeof(struct ifreq))
102
105
struct
lwip_setgetsockopt_data {
107
int
s;
109
int
level;
111
int
optname;
114
#if LWIP_MPU_COMPATIBLE
115
u8_t optval[LWIP_SETGETSOCKOPT_MAXOPTLEN];
116
#else
117
union
{
118
void
*p;
119
const
void
*pc;
120
} optval;
121
#endif
123
socklen_t optlen;
125
int
err;
127
void
* completed_sem;
128
};
129
#endif
/* !LWIP_TCPIP_CORE_LOCKING */
130
131
#ifdef __cplusplus
132
}
133
#endif
134
135
struct
lwip_sock* lwip_socket_dbg_get_socket(
int
fd);
136
137
#if LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL
138
139
#if LWIP_NETCONN_SEM_PER_THREAD
140
#define SELECT_SEM_T sys_sem_t*
141
#define SELECT_SEM_PTR(sem) (sem)
142
#else
/* LWIP_NETCONN_SEM_PER_THREAD */
143
#define SELECT_SEM_T sys_sem_t
144
#define SELECT_SEM_PTR(sem) (&(sem))
145
#endif
/* LWIP_NETCONN_SEM_PER_THREAD */
146
148
struct
lwip_select_cb {
150
struct
lwip_select_cb *next;
152
struct
lwip_select_cb *prev;
153
#if LWIP_SOCKET_SELECT
155
fd_set *readset;
157
fd_set *writeset;
159
fd_set *exceptset;
160
#endif
/* LWIP_SOCKET_SELECT */
161
#if LWIP_SOCKET_POLL
163
struct
pollfd *poll_fds;
165
nfds_t poll_nfds;
166
#endif
/* LWIP_SOCKET_POLL */
168
int
sem_signalled;
170
SELECT_SEM_T sem;
171
};
172
#endif
/* LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL */
173
174
#endif
/* LWIP_SOCKET */
175
176
#endif
/* LWIP_HDR_SOCKETS_PRIV_H */
err.h
opt.h
sockets.h
sys.h
core
ps2ip
include
lwip_include
lwip
priv
sockets_priv.h
Generated by
1.18.0