source: arduino-1-6-7/trunk/fuentes/arduino-ide-amd64/hardware/arduino/avr/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/SERVICES/LWIP/lwip-1.3.2/src/include/lwip/tcpip.h @ 4837

Last change on this file since 4837 was 4837, checked in by daduve, 2 years ago

Adding new version

File size: 4.4 KB
Line 
1/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
2
3/*
4 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without modification,
8 * are permitted provided that the following conditions are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright notice,
11 *    this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright notice,
13 *    this list of conditions and the following disclaimer in the documentation
14 *    and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 *    derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
21 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
23 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
26 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
27 * OF SUCH DAMAGE.
28 *
29 * This file is part of the lwIP TCP/IP stack.
30 *
31 * Author: Adam Dunkels <adam@sics.se>
32 *
33 */
34#ifndef __LWIP_TCPIP_H__
35#define __LWIP_TCPIP_H__
36
37#include "lwip/opt.h"
38
39#if !NO_SYS /* don't build if not configured for use in lwipopts.h */
40
41#include "lwip/api_msg.h"
42#include "lwip/netifapi.h"
43#include "lwip/pbuf.h"
44#include "lwip/api.h"
45#include "lwip/sys.h"
46#include "lwip/netif.h"
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52#if LWIP_TCPIP_CORE_LOCKING
53/** The global semaphore to lock the stack. */
54extern sys_sem_t lock_tcpip_core;
55#define LOCK_TCPIP_CORE()     sys_sem_wait(lock_tcpip_core)
56#define UNLOCK_TCPIP_CORE()   sys_sem_signal(lock_tcpip_core)
57#define TCPIP_APIMSG(m)       tcpip_apimsg_lock(m)
58#define TCPIP_APIMSG_ACK(m)
59#define TCPIP_NETIFAPI(m)     tcpip_netifapi_lock(m)
60#define TCPIP_NETIFAPI_ACK(m)
61#else
62#define LOCK_TCPIP_CORE()
63#define UNLOCK_TCPIP_CORE()
64#define TCPIP_APIMSG(m)       tcpip_apimsg(m)
65#define TCPIP_APIMSG_ACK(m)   sys_sem_signal(m->conn->op_completed)
66#define TCPIP_NETIFAPI(m)     tcpip_netifapi(m)
67#define TCPIP_NETIFAPI_ACK(m) sys_sem_signal(m->sem)
68#endif /* LWIP_TCPIP_CORE_LOCKING */
69
70void tcpip_init(void (* tcpip_init_done)(void *), void *arg);
71
72#if LWIP_NETCONN
73err_t tcpip_apimsg(struct api_msg *apimsg);
74#if LWIP_TCPIP_CORE_LOCKING
75err_t tcpip_apimsg_lock(struct api_msg *apimsg);
76#endif /* LWIP_TCPIP_CORE_LOCKING */
77#endif /* LWIP_NETCONN */
78
79err_t tcpip_input(struct pbuf *p, struct netif *inp);
80
81#if LWIP_NETIF_API
82err_t tcpip_netifapi(struct netifapi_msg *netifapimsg);
83#if LWIP_TCPIP_CORE_LOCKING
84err_t tcpip_netifapi_lock(struct netifapi_msg *netifapimsg);
85#endif /* LWIP_TCPIP_CORE_LOCKING */
86#endif /* LWIP_NETIF_API */
87
88err_t tcpip_callback_with_block(void (*f)(void *ctx), void *ctx, u8_t block);
89#define tcpip_callback(f, ctx)              tcpip_callback_with_block(f, ctx, 1)
90
91/* free pbufs or heap memory from another context without blocking */
92err_t pbuf_free_callback(struct pbuf *p);
93err_t mem_free_callback(void *m);
94
95err_t tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg);
96err_t tcpip_untimeout(sys_timeout_handler h, void *arg);
97
98enum tcpip_msg_type {
99#if LWIP_NETCONN
100  TCPIP_MSG_API,
101#endif /* LWIP_NETCONN */
102  TCPIP_MSG_INPKT,
103#if LWIP_NETIF_API
104  TCPIP_MSG_NETIFAPI,
105#endif /* LWIP_NETIF_API */
106  TCPIP_MSG_CALLBACK,
107  TCPIP_MSG_TIMEOUT,
108  TCPIP_MSG_UNTIMEOUT
109};
110
111struct tcpip_msg {
112  enum tcpip_msg_type type;
113  sys_sem_t *sem;
114  union {
115#if LWIP_NETCONN
116    struct api_msg *apimsg;
117#endif /* LWIP_NETCONN */
118#if LWIP_NETIF_API
119    struct netifapi_msg *netifapimsg;
120#endif /* LWIP_NETIF_API */
121    struct {
122      struct pbuf *p;
123      struct netif *netif;
124    } inp;
125    struct {
126      void (*f)(void *ctx);
127      void *ctx;
128    } cb;
129    struct {
130      u32_t msecs;
131      sys_timeout_handler h;
132      void *arg;
133    } tmo;
134  } msg;
135};
136
137#ifdef __cplusplus
138}
139#endif
140
141#endif /* !NO_SYS */
142
143#endif /* __LWIP_TCPIP_H__ */
Note: See TracBrowser for help on using the repository browser.