sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
tcpip_priv.h
Go to the documentation of this file.
1
6
7/*
8 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
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: Adam Dunkels <adam@sics.se>
36 *
37 */
38#ifndef LWIP_HDR_TCPIP_PRIV_H
39#define LWIP_HDR_TCPIP_PRIV_H
40
41#include "lwip/opt.h"
42
43#if !NO_SYS /* don't build if not configured for use in lwipopts.h */
44
45#include "lwip/tcpip.h"
46#include "lwip/sys.h"
47#include "lwip/timeouts.h"
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53struct pbuf;
54struct netif;
55
56#if LWIP_MPU_COMPATIBLE
57#define API_VAR_REF(name) (*(name))
58#define API_VAR_DECLARE(type, name) type * name
59#define API_VAR_ALLOC_EXT(type, pool, name, errorblock) do { \
60 name = (type *)memp_malloc(pool); \
61 if (name == NULL) { \
62 errorblock; \
63 } \
64 } while(0)
65#define API_VAR_ALLOC(type, pool, name, errorval) API_VAR_ALLOC_EXT(type, pool, name, return errorval)
66#define API_VAR_ALLOC_POOL(type, pool, name, errorval) do { \
67 name = (type *)LWIP_MEMPOOL_ALLOC(pool); \
68 if (name == NULL) { \
69 return errorval; \
70 } \
71 } while(0)
72#define API_VAR_FREE(pool, name) memp_free(pool, name)
73#define API_VAR_FREE_POOL(pool, name) LWIP_MEMPOOL_FREE(pool, name)
74#define API_EXPR_REF(expr) (&(expr))
75#if LWIP_NETCONN_SEM_PER_THREAD
76#define API_EXPR_REF_SEM(expr) (expr)
77#else
78#define API_EXPR_REF_SEM(expr) API_EXPR_REF(expr)
79#endif
80#define API_EXPR_DEREF(expr) expr
81#define API_MSG_M_DEF(m) m
82#define API_MSG_M_DEF_C(t, m) t m
83#else /* LWIP_MPU_COMPATIBLE */
84#define API_VAR_REF(name) name
85#define API_VAR_DECLARE(type, name) type name
86#define API_VAR_ALLOC_EXT(type, pool, name, errorblock)
87#define API_VAR_ALLOC(type, pool, name, errorval)
88#define API_VAR_ALLOC_POOL(type, pool, name, errorval)
89#define API_VAR_FREE(pool, name)
90#define API_VAR_FREE_POOL(pool, name)
91#define API_EXPR_REF(expr) expr
92#define API_EXPR_REF_SEM(expr) API_EXPR_REF(expr)
93#define API_EXPR_DEREF(expr) (*(expr))
94#define API_MSG_M_DEF(m) *m
95#define API_MSG_M_DEF_C(t, m) const t * m
96#endif /* LWIP_MPU_COMPATIBLE */
97
98err_t tcpip_send_msg_wait_sem(tcpip_callback_fn fn, void *apimsg, sys_sem_t* sem);
99
101{
102#if !LWIP_TCPIP_CORE_LOCKING
103 err_t err;
104#if !LWIP_NETCONN_SEM_PER_THREAD
105 sys_sem_t sem;
106#endif /* LWIP_NETCONN_SEM_PER_THREAD */
107#else /* !LWIP_TCPIP_CORE_LOCKING */
108 u8_t dummy; /* avoid empty struct :-( */
109#endif /* !LWIP_TCPIP_CORE_LOCKING */
110};
111typedef err_t (*tcpip_api_call_fn)(struct tcpip_api_call_data* call);
112err_t tcpip_api_call(tcpip_api_call_fn fn, struct tcpip_api_call_data *call);
113
114enum tcpip_msg_type {
115#if !LWIP_TCPIP_CORE_LOCKING
116 TCPIP_MSG_API,
117 TCPIP_MSG_API_CALL,
118#endif /* !LWIP_TCPIP_CORE_LOCKING */
119#if !LWIP_TCPIP_CORE_LOCKING_INPUT
120 TCPIP_MSG_INPKT,
121#endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */
122#if LWIP_TCPIP_TIMEOUT && LWIP_TIMERS
123 TCPIP_MSG_TIMEOUT,
124 TCPIP_MSG_UNTIMEOUT,
125#endif /* LWIP_TCPIP_TIMEOUT && LWIP_TIMERS */
126 TCPIP_MSG_CALLBACK,
127 TCPIP_MSG_CALLBACK_STATIC,
128 TCPIP_MSG_CALLBACK_STATIC_WAIT
129};
130
131struct tcpip_msg {
132 enum tcpip_msg_type type;
133 union {
134#if !LWIP_TCPIP_CORE_LOCKING
135 struct {
136 tcpip_callback_fn function;
137 void* msg;
138 } api_msg;
139 struct {
140 tcpip_api_call_fn function;
141 struct tcpip_api_call_data *arg;
142 sys_sem_t *sem;
143 } api_call;
144 struct {
145 tcpip_callback_fn function;
146 void *ctx;
147 sys_sem_t *sem;
148 } cb_wait;
149#endif /* LWIP_TCPIP_CORE_LOCKING */
150#if !LWIP_TCPIP_CORE_LOCKING_INPUT
151 struct {
152 struct pbuf *p;
153 struct netif *netif;
154 netif_input_fn input_fn;
155 } inp;
156#endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */
157 struct {
158 tcpip_callback_fn function;
159 void *ctx;
160 } cb;
161#if LWIP_TCPIP_TIMEOUT && LWIP_TIMERS
162 struct {
163 u32_t msecs;
164 sys_timeout_handler h;
165 void *arg;
166 } tmo;
167#endif /* LWIP_TCPIP_TIMEOUT && LWIP_TIMERS */
168 } msg;
169};
170
171#ifdef __cplusplus
172}
173#endif
174
175#endif /* !NO_SYS */
176
177#endif /* LWIP_HDR_TCPIP_PRIV_H */
err_t(*) netif_input_fn(struct pbuf *p, struct netif *inp)
Definition tcpip.h:1207
void(*) tcpip_callback_fn(void *ctx)
Definition ps2ip.h:74
Definition tcpip.h:234
err_t tcpip_send_msg_wait_sem(tcpip_callback_fn fn, void *apimsg, sys_sem_t *sem)
Definition tcpip.c:451
err_t tcpip_api_call(tcpip_api_call_fn fn, struct tcpip_api_call_data *call)
Definition tcpip.c:487