ReactOS 0.4.15-dev-8222-g9164419
api_msg.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
25 * OF SUCH DAMAGE.
26 *
27 * This file is part of the lwIP TCP/IP stack.
28 *
29 * Author: Adam Dunkels <adam@sics.se>
30 *
31 */
32#ifndef __LWIP_API_MSG_H__
33#define __LWIP_API_MSG_H__
34
35#include "lwip/opt.h"
36
37#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */
38
39#include <stddef.h> /* for size_t */
40
41#include "lwip/ip_addr.h"
42#include "lwip/err.h"
43#include "lwip/sys.h"
44#include "lwip/igmp.h"
45#include "lwip/api.h"
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51/* For the netconn API, these values are use as a bitmask! */
52#define NETCONN_SHUT_RD 1
53#define NETCONN_SHUT_WR 2
54#define NETCONN_SHUT_RDWR (NETCONN_SHUT_RD | NETCONN_SHUT_WR)
55
56/* IP addresses and port numbers are expected to be in
57 * the same byte order as in the corresponding pcb.
58 */
62struct api_msg_msg {
65 struct netconn *conn;
67 err_t err;
69 union {
71 struct netbuf *b;
73 struct {
74 u8_t proto;
75 } n;
77 struct {
78 ip_addr_t *ipaddr;
79 u16_t port;
80 } bc;
82 struct {
83 ip_addr_t *ipaddr;
84 u16_t *port;
85 u8_t local;
86 } ad;
88 struct {
89 const void *dataptr;
90 size_t len;
91 u8_t apiflags;
92#if LWIP_SO_SNDTIMEO
93 u32_t time_started;
94#endif /* LWIP_SO_SNDTIMEO */
95 } w;
97 struct {
98 u32_t len;
99 } r;
101 struct {
102 u8_t shut;
103 } sd;
104#if LWIP_IGMP
106 struct {
107 ip_addr_t *multiaddr;
108 ip_addr_t *netif_addr;
109 enum netconn_igmp join_or_leave;
110 } jl;
111#endif /* LWIP_IGMP */
112#if TCP_LISTEN_BACKLOG
113 struct {
114 u8_t backlog;
115 } lb;
116#endif /* TCP_LISTEN_BACKLOG */
117 } msg;
118};
119
123struct api_msg {
125 void (* function)(struct api_msg_msg *msg);
127 struct api_msg_msg msg;
128};
129
130#if LWIP_DNS
135struct dns_api_msg {
137 const char *name;
142 sys_sem_t *sem;
144 err_t *err;
145};
146#endif /* LWIP_DNS */
147
148void do_newconn ( struct api_msg_msg *msg);
149void do_delconn ( struct api_msg_msg *msg);
150void do_bind ( struct api_msg_msg *msg);
151void do_connect ( struct api_msg_msg *msg);
152void do_disconnect ( struct api_msg_msg *msg);
153void do_listen ( struct api_msg_msg *msg);
154void do_send ( struct api_msg_msg *msg);
155void do_recv ( struct api_msg_msg *msg);
156void do_write ( struct api_msg_msg *msg);
157void do_getaddr ( struct api_msg_msg *msg);
158void do_close ( struct api_msg_msg *msg);
159void do_shutdown ( struct api_msg_msg *msg);
160#if LWIP_IGMP
161void do_join_leave_group( struct api_msg_msg *msg);
162#endif /* LWIP_IGMP */
163
164#if LWIP_DNS
165void do_gethostbyname(void *arg);
166#endif /* LWIP_DNS */
167
168struct netconn* netconn_alloc(enum netconn_type t, netconn_callback callback);
169void netconn_free(struct netconn *conn);
170
171#ifdef __cplusplus
172}
173#endif
174
175#endif /* LWIP_NETCONN */
176
177#endif /* __LWIP_API_MSG_H__ */
#define msg(x)
Definition: auth_time.c:54
PBATCH_CONTEXT bc
Definition: batch.c:67
NTSTATUS do_write(device_extension *Vcb, PIRP Irp)
Definition: flushthread.c:7877
USHORT port
Definition: uri.c:228
void do_shutdown(PIRP Irp)
Definition: btrfs.c:5392
unsigned long u32_t
Definition: cc.h:25
unsigned char u8_t
Definition: cc.h:23
unsigned short u16_t
Definition: cc.h:24
s8_t err_t
Definition: err.h:47
#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
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
typedefPACK_STRUCT_END struct ip_addr ip_addr_t
Definition: ip_addr.h:64
int const JOCTET * dataptr
Definition: jpeglib.h:1031
#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
#define err(...)
static void do_close(SOCKET)
static void do_bind(SOCKET s, struct sockaddr *addr, int addrlen)
Definition: sock.c:507
Definition: name.c:39
Definition: types.h:144