ReactOS 0.4.16-dev-340-g0540c21
api_msg.h
Go to the documentation of this file.
1
6/*
7 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without modification,
11 * are permitted provided that the following conditions are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * 3. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
22 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
24 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
30 * OF SUCH DAMAGE.
31 *
32 * This file is part of the lwIP TCP/IP stack.
33 *
34 * Author: Adam Dunkels <adam@sics.se>
35 *
36 */
37#ifndef LWIP_HDR_API_MSG_H
38#define LWIP_HDR_API_MSG_H
39
40#include "lwip/opt.h"
41
42#include "lwip/arch.h"
43#include "lwip/ip_addr.h"
44#include "lwip/err.h"
45#include "lwip/sys.h"
46#include "lwip/igmp.h"
47#include "lwip/api.h"
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54#if LWIP_NETCONN || LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */
55/* Note: Netconn API is always available when sockets are enabled -
56 * sockets are implemented on top of them */
57
58#if LWIP_MPU_COMPATIBLE
59#if LWIP_NETCONN_SEM_PER_THREAD
60#define API_MSG_M_DEF_SEM(m) *m
61#else
62#define API_MSG_M_DEF_SEM(m) API_MSG_M_DEF(m)
63#endif
64#else /* LWIP_MPU_COMPATIBLE */
65#define API_MSG_M_DEF_SEM(m) API_MSG_M_DEF(m)
66#endif /* LWIP_MPU_COMPATIBLE */
67
68/* For the netconn API, these values are use as a bitmask! */
69#define NETCONN_SHUT_RD 1
70#define NETCONN_SHUT_WR 2
71#define NETCONN_SHUT_RDWR (NETCONN_SHUT_RD | NETCONN_SHUT_WR)
72
73/* IP addresses and port numbers are expected to be in
74 * the same byte order as in the corresponding pcb.
75 */
79struct api_msg {
82 struct netconn *conn;
84 err_t err;
86 union {
88 struct netbuf *b;
90 struct {
91 u8_t proto;
92 } n;
94 struct {
96 u16_t port;
97 u8_t if_idx;
98 } bc;
100 struct {
101 ip_addr_t API_MSG_M_DEF(ipaddr);
103 u8_t local;
104 } ad;
106 struct {
108 const struct netvector *vector;
110 u16_t vector_cnt;
112 size_t vector_off;
114 size_t len;
116 size_t offset;
117 u8_t apiflags;
118#if LWIP_SO_SNDTIMEO
119 u32_t time_started;
120#endif /* LWIP_SO_SNDTIMEO */
121 } w;
123 struct {
124 size_t len;
125 } r;
126#if LWIP_TCP
128 struct {
129 u8_t shut;
130#if LWIP_SO_SNDTIMEO || LWIP_SO_LINGER
131 u32_t time_started;
132#else /* LWIP_SO_SNDTIMEO || LWIP_SO_LINGER */
133 u8_t polls_left;
134#endif /* LWIP_SO_SNDTIMEO || LWIP_SO_LINGER */
135 } sd;
136#endif /* LWIP_TCP */
137#if LWIP_IGMP || (LWIP_IPV6 && LWIP_IPV6_MLD)
139 struct {
140 API_MSG_M_DEF_C(ip_addr_t, multiaddr);
141 API_MSG_M_DEF_C(ip_addr_t, netif_addr);
142 u8_t if_idx;
143 enum netconn_igmp join_or_leave;
144 } jl;
145#endif /* LWIP_IGMP || (LWIP_IPV6 && LWIP_IPV6_MLD) */
146#if TCP_LISTEN_BACKLOG
147 struct {
148 u8_t backlog;
149 } lb;
150#endif /* TCP_LISTEN_BACKLOG */
151 } msg;
152#if LWIP_NETCONN_SEM_PER_THREAD
153 sys_sem_t* op_completed_sem;
154#endif /* LWIP_NETCONN_SEM_PER_THREAD */
155};
156
157#if LWIP_NETCONN_SEM_PER_THREAD
158#define LWIP_API_MSG_SEM(msg) ((msg)->op_completed_sem)
159#else /* LWIP_NETCONN_SEM_PER_THREAD */
160#define LWIP_API_MSG_SEM(msg) (&(msg)->conn->op_completed)
161#endif /* LWIP_NETCONN_SEM_PER_THREAD */
162
163
164#if LWIP_DNS
169struct dns_api_msg {
171#if LWIP_MPU_COMPATIBLE
173#else /* LWIP_MPU_COMPATIBLE */
174 const char *name;
175#endif /* LWIP_MPU_COMPATIBLE */
178#if LWIP_IPV4 && LWIP_IPV6
180 u8_t dns_addrtype;
181#endif /* LWIP_IPV4 && LWIP_IPV6 */
184 sys_sem_t API_MSG_M_DEF_SEM(sem);
187};
188#endif /* LWIP_DNS */
189
190#if LWIP_NETCONN_FULLDUPLEX
191int lwip_netconn_is_deallocated_msg(void *msg);
192#endif
193int lwip_netconn_is_err_msg(void *msg, err_t *err);
194void lwip_netconn_do_newconn (void *m);
195void lwip_netconn_do_delconn (void *m);
196void lwip_netconn_do_bind (void *m);
197void lwip_netconn_do_bind_if (void *m);
198void lwip_netconn_do_connect (void *m);
199void lwip_netconn_do_disconnect (void *m);
200void lwip_netconn_do_listen (void *m);
201void lwip_netconn_do_send (void *m);
202void lwip_netconn_do_recv (void *m);
203#if TCP_LISTEN_BACKLOG
204void lwip_netconn_do_accepted (void *m);
205#endif /* TCP_LISTEN_BACKLOG */
206void lwip_netconn_do_write (void *m);
207void lwip_netconn_do_getaddr (void *m);
208void lwip_netconn_do_close (void *m);
209void lwip_netconn_do_shutdown (void *m);
210#if LWIP_IGMP || (LWIP_IPV6 && LWIP_IPV6_MLD)
211void lwip_netconn_do_join_leave_group(void *m);
212void lwip_netconn_do_join_leave_group_netif(void *m);
213#endif /* LWIP_IGMP || (LWIP_IPV6 && LWIP_IPV6_MLD) */
214
215#if LWIP_DNS
216void lwip_netconn_do_gethostbyname(void *arg);
217#endif /* LWIP_DNS */
218
219struct netconn* netconn_alloc(enum netconn_type t, netconn_callback callback);
220void netconn_free(struct netconn *conn);
221
222#endif /* LWIP_NETCONN || LWIP_SOCKET */
223
224#if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */
225
226/* netifapi related lwIP internal definitions */
227
228#if LWIP_MPU_COMPATIBLE
229#define NETIFAPI_IPADDR_DEF(type, m) type m
230#else /* LWIP_MPU_COMPATIBLE */
231#define NETIFAPI_IPADDR_DEF(type, m) const type * m
232#endif /* LWIP_MPU_COMPATIBLE */
233
234typedef void (*netifapi_void_fn)(struct netif *netif);
235typedef err_t (*netifapi_errt_fn)(struct netif *netif);
236
237struct netifapi_msg {
238 struct tcpip_api_call_data call;
239 struct netif *netif;
240 union {
241 struct {
242#if LWIP_IPV4
243 NETIFAPI_IPADDR_DEF(ip4_addr_t, ipaddr);
244 NETIFAPI_IPADDR_DEF(ip4_addr_t, netmask);
245 NETIFAPI_IPADDR_DEF(ip4_addr_t, gw);
246#endif /* LWIP_IPV4 */
247 void *state;
250 } add;
251 struct {
252 netifapi_void_fn voidfunc;
253 netifapi_errt_fn errtfunc;
254 } common;
255 struct {
256#if LWIP_MPU_COMPATIBLE
257 char name[NETIF_NAMESIZE];
258#else /* LWIP_MPU_COMPATIBLE */
259 char *name;
260#endif /* LWIP_MPU_COMPATIBLE */
261 u8_t index;
262 } ifs;
263 } msg;
264};
265
266#endif /* LWIP_NETIF_API */
267
268#ifdef __cplusplus
269}
270#endif
271
272#endif /* LWIP_HDR_API_MSG_H */
static int state
Definition: maze.c:121
#define msg(x)
Definition: auth_time.c:54
#define index(s, c)
Definition: various.h:29
PBATCH_CONTEXT bc
Definition: batch.c:67
USHORT port
Definition: uri.c:228
#define local
Definition: zutil.h:30
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble t
Definition: gl.h:2047
GLdouble n
Definition: glext.h:7729
GLenum const GLvoid * addr
Definition: glext.h:9621
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum GLenum input
Definition: glext.h:9031
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLintptr offset
Definition: glext.h:5920
const GLfloat * m
Definition: glext.h:10848
uint32_t u32_t
Definition: arch.h:129
uint8_t u8_t
Definition: arch.h:125
uint16_t u16_t
Definition: arch.h:127
s8_t err_t
Definition: err.h:96
#define DNS_MAX_NAME_LENGTH
Definition: opt.h:1145
ip6_addr_t ip_addr_t
Definition: ip_addr.h:344
#define b
Definition: ke_i.h:79
static IPrintDialogCallback callback
Definition: printdlg.c:326
static HANDLE sem
Definition: sync.c:674
static const WCHAR sd[]
Definition: suminfo.c:286
err_t(* netif_init_fn)(struct netif *netif)
Definition: netif.h:171
#define NETIF_NAMESIZE
Definition: netif.h:70
err_t(* netif_input_fn)(struct pbuf *p, struct netif *inp)
Definition: netif.h:181
#define err(...)
Definition: name.c:39
Definition: types.h:144
Definition: netif.h:269
#define API_MSG_M_DEF_C(t, m)
Definition: tcpip_priv.h:94
#define API_MSG_M_DEF(m)
Definition: tcpip_priv.h:93
static int init
Definition: wintirpc.c:33