Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / lwip / repo / lwip / src / include / lwip / tcpip.h
1 /**
2  * @file
3  * Functions to sync with TCPIP thread
4  */
5
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_TCPIP_H
38 #define LWIP_HDR_TCPIP_H
39
40 #include "lwip/opt.h"
41
42 #if !NO_SYS /* don't build if not configured for use in lwipopts.h */
43
44 #include "lwip/err.h"
45 #include "lwip/timeouts.h"
46 #include "lwip/netif.h"
47
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51
52 #if LWIP_TCPIP_CORE_LOCKING
53 /** The global semaphore to lock the stack. */
54 extern sys_mutex_t lock_tcpip_core;
55 /** Lock lwIP core mutex (needs @ref LWIP_TCPIP_CORE_LOCKING 1) */
56 #define LOCK_TCPIP_CORE()     sys_mutex_lock(&lock_tcpip_core)
57 /** Unlock lwIP core mutex (needs @ref LWIP_TCPIP_CORE_LOCKING 1) */
58 #define UNLOCK_TCPIP_CORE()   sys_mutex_unlock(&lock_tcpip_core)
59 #else /* LWIP_TCPIP_CORE_LOCKING */
60 #define LOCK_TCPIP_CORE()
61 #define UNLOCK_TCPIP_CORE()
62 #endif /* LWIP_TCPIP_CORE_LOCKING */
63
64 struct pbuf;
65 struct netif;
66
67 #if LWIP_NETCONN
68 struct api_msg;
69 #endif /* LWIP_NETCONN */
70
71 /** Function prototype for the init_done function passed to tcpip_init */
72 typedef void (*tcpip_init_done_fn)(void *arg);
73 typedef void (*tcpip_will_finish_fn)(void *arg);
74 /** Function prototype for functions passed to tcpip_callback() */
75 typedef void (*tcpip_callback_fn)(void *ctx);
76
77 /* Forward declarations */
78 struct tcpip_callback_msg;
79
80 void   tcpip_init(tcpip_init_done_fn tcpip_init_done, void *arg);
81 err_t  tcpip_finish(tcpip_will_finish_fn tcpip_will_finish, void *arg);
82
83 #if LWIP_NETCONN
84 err_t  tcpip_apimsg(struct api_msg *apimsg);
85 #endif /* LWIP_NETCONN */
86
87 err_t  tcpip_inpkt(struct pbuf *p, struct netif *inp, netif_input_fn input_fn);
88 err_t  tcpip_input(struct pbuf *p, struct netif *inp);
89
90 err_t  tcpip_callback_with_block(tcpip_callback_fn function, void *ctx, u8_t block);
91 /**
92  * @ingroup lwip_os
93  * @see tcpip_callback_with_block
94  */
95 #define tcpip_callback(f, ctx)  tcpip_callback_with_block(f, ctx, 1)
96
97 struct tcpip_callback_msg* tcpip_callbackmsg_new(tcpip_callback_fn function, void *ctx);
98 void   tcpip_callbackmsg_delete(struct tcpip_callback_msg* msg);
99 err_t  tcpip_trycallback(struct tcpip_callback_msg* msg);
100
101 /* free pbufs or heap memory from another context without blocking */
102 err_t  pbuf_free_callback(struct pbuf *p);
103 err_t  mem_free_callback(void *m);
104
105 #if LWIP_TCPIP_TIMEOUT && LWIP_TIMERS
106 err_t  tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg);
107 err_t  tcpip_untimeout(sys_timeout_handler h, void *arg);
108 #endif /* LWIP_TCPIP_TIMEOUT && LWIP_TIMERS */
109
110 #ifdef __cplusplus
111 }
112 #endif
113
114 #endif /* !NO_SYS */
115
116 #endif /* LWIP_HDR_TCPIP_H */