The Pedigree Project 0.1
icmp.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_ICMP_H
57#define LWIP_HDR_ICMP_H
58
59#include "lwip/opt.h"
60#include "lwip/pbuf.h"
61#include "lwip/ip_addr.h"
62#include "lwip/netif.h"
63#include "lwip/prot/icmp.h"
64
65#if LWIP_IPV6 && LWIP_ICMP6
66#include "lwip/icmp6.h"
67#endif
68
69#ifdef __cplusplus
70extern "C" {
71#endif
72
88
96
97#if LWIP_IPV4 && LWIP_ICMP /* don't build if not configured for use in lwipopts.h */
98
99void icmp_input(struct pbuf *p, struct netif *inp);
100void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t);
101void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t);
102
103#endif /* LWIP_IPV4 && LWIP_ICMP */
104
105#if LWIP_IPV4 && LWIP_IPV6
106#if LWIP_ICMP && LWIP_ICMP6
107#define icmp_port_unreach(isipv6, pbuf) ((isipv6) ? \
108 icmp6_dest_unreach(pbuf, ICMP6_DUR_PORT) : \
109 icmp_dest_unreach(pbuf, ICMP_DUR_PORT))
110#elif LWIP_ICMP
111#define icmp_port_unreach(isipv6, pbuf) do{ if(!(isipv6)) { icmp_dest_unreach(pbuf, ICMP_DUR_PORT);}}while(0)
112#elif LWIP_ICMP6
113#define icmp_port_unreach(isipv6, pbuf) do{ if(isipv6) { icmp6_dest_unreach(pbuf, ICMP6_DUR_PORT);}}while(0)
114#else
115#define icmp_port_unreach(isipv6, pbuf)
116#endif
117#elif LWIP_IPV6 && LWIP_ICMP6
118#define icmp_port_unreach(isipv6, pbuf) icmp6_dest_unreach(pbuf, ICMP6_DUR_PORT)
119#elif LWIP_IPV4 && LWIP_ICMP
120#define icmp_port_unreach(isipv6, pbuf) icmp_dest_unreach(pbuf, ICMP_DUR_PORT)
121#else /* (LWIP_IPV6 && LWIP_ICMP6) || (LWIP_IPV4 && LWIP_ICMP) */
122#define icmp_port_unreach(isipv6, pbuf)
123#endif /* (LWIP_IPV6 && LWIP_ICMP6) || (LWIP_IPV4 && LWIP_ICMP) LWIP_IPV4*/
124
125#ifdef __cplusplus
126}
127#endif
128
129#endif /* LWIP_HDR_ICMP_H */
icmp_te_type
Definition icmp.h:90
@ ICMP_TE_FRAG
Definition icmp.h:94
@ ICMP_TE_TTL
Definition icmp.h:92
icmp_dur_type
Definition icmp.h:74
@ ICMP_DUR_PROTO
Definition icmp.h:80
@ ICMP_DUR_NET
Definition icmp.h:76
@ ICMP_DUR_HOST
Definition icmp.h:78
@ ICMP_DUR_FRAG
Definition icmp.h:84
@ ICMP_DUR_PORT
Definition icmp.h:82
@ ICMP_DUR_SR
Definition icmp.h:86
Definition netif.h:244
Definition pbuf.h:161