The Pedigree Project  0.1
ip4.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
25 /*
26  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
27  * All rights reserved.
28  *
29  * Redistribution and use in source and binary forms, with or without modification,
30  * are permitted provided that the following conditions are met:
31  *
32  * 1. Redistributions of source code must retain the above copyright notice,
33  * this list of conditions and the following disclaimer.
34  * 2. Redistributions in binary form must reproduce the above copyright notice,
35  * this list of conditions and the following disclaimer in the documentation
36  * and/or other materials provided with the distribution.
37  * 3. The name of the author may not be used to endorse or promote products
38  * derived from this software without specific prior written permission.
39  *
40  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
41  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
42  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
43  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
44  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
45  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
46  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
48  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
49  * OF SUCH DAMAGE.
50  *
51  * This file is part of the lwIP TCP/IP stack.
52  *
53  * Author: Adam Dunkels <adam@sics.se>
54  *
55  */
56 #ifndef LWIP_HDR_IP4_H
57 #define LWIP_HDR_IP4_H
58 
59 #include "lwip/opt.h"
60 
61 #if LWIP_IPV4
62 
63 #include "lwip/def.h"
64 #include "lwip/pbuf.h"
65 #include "lwip/ip4_addr.h"
66 #include "lwip/err.h"
67 #include "lwip/netif.h"
68 #include "lwip/prot/ip4.h"
69 
70 #ifdef __cplusplus
71 extern "C" {
72 #endif
73 
74 #ifdef LWIP_HOOK_IP4_ROUTE_SRC
75 #define LWIP_IPV4_SRC_ROUTING 1
76 #else
77 #define LWIP_IPV4_SRC_ROUTING 0
78 #endif
79 
81 #define IP_OPTIONS_SEND (LWIP_IPV4 && LWIP_IGMP)
82 
83 #define ip_init() /* Compatibility define, no init needed. */
84 struct netif *ip4_route(const ip4_addr_t *dest);
85 #if LWIP_IPV4_SRC_ROUTING
86 struct netif *ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src);
87 #else /* LWIP_IPV4_SRC_ROUTING */
88 #define ip4_route_src(dest, src) ip4_route(dest)
89 #endif /* LWIP_IPV4_SRC_ROUTING */
90 err_t ip4_input(struct pbuf *p, struct netif *inp);
91 err_t ip4_output(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
92  u8_t ttl, u8_t tos, u8_t proto);
93 err_t ip4_output_if(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
94  u8_t ttl, u8_t tos, u8_t proto, struct netif *netif);
95 err_t ip4_output_if_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
96  u8_t ttl, u8_t tos, u8_t proto, struct netif *netif);
97 #if LWIP_NETIF_HWADDRHINT
98 err_t ip4_output_hinted(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
99  u8_t ttl, u8_t tos, u8_t proto, u8_t *addr_hint);
100 #endif /* LWIP_NETIF_HWADDRHINT */
101 #if IP_OPTIONS_SEND
102 err_t ip4_output_if_opt(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
103  u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options,
104  u16_t optlen);
105 err_t ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
106  u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options,
107  u16_t optlen);
108 #endif /* IP_OPTIONS_SEND */
109 
110 #if LWIP_MULTICAST_TX_OPTIONS
111 void ip4_set_default_multicast_netif(struct netif* default_multicast_netif);
112 #endif /* LWIP_MULTICAST_TX_OPTIONS */
113 
114 #define ip4_netif_get_local_ip(netif) (((netif) != NULL) ? netif_ip_addr4(netif) : NULL)
115 
116 #if IP_DEBUG
117 void ip4_debug_print(struct pbuf *p);
118 #else
119 #define ip4_debug_print(p)
120 #endif /* IP_DEBUG */
121 
122 #ifdef __cplusplus
123 }
124 #endif
125 
126 #endif /* LWIP_IPV4 */
127 
128 #endif /* LWIP_HDR_IP_H */
129 
130 
Definition: pbuf.h:161
Definition: netif.h:244
s8_t err_t
Definition: err.h:76