This library is deprecated.

Dependents:   HTTPClientStreamingExample HTTPClientExample HTTPServerExample HTTPServerHelloWorld ... more

Committer:
donatien
Date:
Thu Aug 05 15:09:22 2010 +0000
Revision:
5:bc7df6da7589
Parent:
0:422060928e37

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
donatien 0:422060928e37 1 /*
donatien 0:422060928e37 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
donatien 0:422060928e37 3 * All rights reserved.
donatien 0:422060928e37 4 *
donatien 0:422060928e37 5 * Redistribution and use in source and binary forms, with or without modification,
donatien 0:422060928e37 6 * are permitted provided that the following conditions are met:
donatien 0:422060928e37 7 *
donatien 0:422060928e37 8 * 1. Redistributions of source code must retain the above copyright notice,
donatien 0:422060928e37 9 * this list of conditions and the following disclaimer.
donatien 0:422060928e37 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
donatien 0:422060928e37 11 * this list of conditions and the following disclaimer in the documentation
donatien 0:422060928e37 12 * and/or other materials provided with the distribution.
donatien 0:422060928e37 13 * 3. The name of the author may not be used to endorse or promote products
donatien 0:422060928e37 14 * derived from this software without specific prior written permission.
donatien 0:422060928e37 15 *
donatien 0:422060928e37 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
donatien 0:422060928e37 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
donatien 0:422060928e37 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
donatien 0:422060928e37 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
donatien 0:422060928e37 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
donatien 0:422060928e37 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
donatien 0:422060928e37 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
donatien 0:422060928e37 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
donatien 0:422060928e37 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
donatien 0:422060928e37 25 * OF SUCH DAMAGE.
donatien 0:422060928e37 26 *
donatien 0:422060928e37 27 * This file is part of the lwIP TCP/IP stack.
donatien 0:422060928e37 28 *
donatien 0:422060928e37 29 * Author: Adam Dunkels <adam@sics.se>
donatien 0:422060928e37 30 *
donatien 0:422060928e37 31 */
donatien 0:422060928e37 32 #ifndef __LWIP_ICMP_H__
donatien 0:422060928e37 33 #define __LWIP_ICMP_H__
donatien 0:422060928e37 34
donatien 0:422060928e37 35 #include "lwip/opt.h"
donatien 0:422060928e37 36 #include "lwip/pbuf.h"
donatien 0:422060928e37 37 #include "lwip/ip_addr.h"
donatien 0:422060928e37 38 #include "lwip/netif.h"
donatien 0:422060928e37 39
donatien 0:422060928e37 40 #ifdef __cplusplus
donatien 0:422060928e37 41 extern "C" {
donatien 0:422060928e37 42 #endif
donatien 0:422060928e37 43
donatien 0:422060928e37 44 #define ICMP_ER 0 /* echo reply */
donatien 0:422060928e37 45 #define ICMP_DUR 3 /* destination unreachable */
donatien 0:422060928e37 46 #define ICMP_SQ 4 /* source quench */
donatien 0:422060928e37 47 #define ICMP_RD 5 /* redirect */
donatien 0:422060928e37 48 #define ICMP_ECHO 8 /* echo */
donatien 0:422060928e37 49 #define ICMP_TE 11 /* time exceeded */
donatien 0:422060928e37 50 #define ICMP_PP 12 /* parameter problem */
donatien 0:422060928e37 51 #define ICMP_TS 13 /* timestamp */
donatien 0:422060928e37 52 #define ICMP_TSR 14 /* timestamp reply */
donatien 0:422060928e37 53 #define ICMP_IRQ 15 /* information request */
donatien 0:422060928e37 54 #define ICMP_IR 16 /* information reply */
donatien 0:422060928e37 55
donatien 0:422060928e37 56 enum icmp_dur_type {
donatien 0:422060928e37 57 ICMP_DUR_NET = 0, /* net unreachable */
donatien 0:422060928e37 58 ICMP_DUR_HOST = 1, /* host unreachable */
donatien 0:422060928e37 59 ICMP_DUR_PROTO = 2, /* protocol unreachable */
donatien 0:422060928e37 60 ICMP_DUR_PORT = 3, /* port unreachable */
donatien 0:422060928e37 61 ICMP_DUR_FRAG = 4, /* fragmentation needed and DF set */
donatien 0:422060928e37 62 ICMP_DUR_SR = 5 /* source route failed */
donatien 0:422060928e37 63 };
donatien 0:422060928e37 64
donatien 0:422060928e37 65 enum icmp_te_type {
donatien 0:422060928e37 66 ICMP_TE_TTL = 0, /* time to live exceeded in transit */
donatien 0:422060928e37 67 ICMP_TE_FRAG = 1 /* fragment reassembly time exceeded */
donatien 0:422060928e37 68 };
donatien 0:422060928e37 69
donatien 0:422060928e37 70 #ifdef PACK_STRUCT_USE_INCLUDES
donatien 0:422060928e37 71 # include "arch/bpstruct.h"
donatien 0:422060928e37 72 #endif
donatien 5:bc7df6da7589 73 /* This is the standard ICMP header only that the u32_t data
donatien 0:422060928e37 74 * is splitted to two u16_t like ICMP echo needs it.
donatien 0:422060928e37 75 * This header is also used for other ICMP types that do not
donatien 0:422060928e37 76 * use the data part.
donatien 0:422060928e37 77 */
donatien 0:422060928e37 78 PACK_STRUCT_BEGIN
donatien 0:422060928e37 79 struct icmp_echo_hdr {
donatien 0:422060928e37 80 PACK_STRUCT_FIELD(u8_t type);
donatien 0:422060928e37 81 PACK_STRUCT_FIELD(u8_t code);
donatien 0:422060928e37 82 PACK_STRUCT_FIELD(u16_t chksum);
donatien 0:422060928e37 83 PACK_STRUCT_FIELD(u16_t id);
donatien 0:422060928e37 84 PACK_STRUCT_FIELD(u16_t seqno);
donatien 0:422060928e37 85 } PACK_STRUCT_STRUCT;
donatien 0:422060928e37 86 PACK_STRUCT_END
donatien 0:422060928e37 87 #ifdef PACK_STRUCT_USE_INCLUDES
donatien 0:422060928e37 88 # include "arch/epstruct.h"
donatien 0:422060928e37 89 #endif
donatien 0:422060928e37 90
donatien 0:422060928e37 91 #define ICMPH_TYPE(hdr) ((hdr)->type)
donatien 0:422060928e37 92 #define ICMPH_CODE(hdr) ((hdr)->code)
donatien 0:422060928e37 93
donatien 5:bc7df6da7589 94 /* Combines type and code to an u16_t */
donatien 0:422060928e37 95 #define ICMPH_TYPE_SET(hdr, t) ((hdr)->type = (t))
donatien 0:422060928e37 96 #define ICMPH_CODE_SET(hdr, c) ((hdr)->code = (c))
donatien 0:422060928e37 97
donatien 0:422060928e37 98
donatien 0:422060928e37 99 #if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */
donatien 0:422060928e37 100
donatien 0:422060928e37 101 void icmp_input(struct pbuf *p, struct netif *inp);
donatien 0:422060928e37 102 void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t);
donatien 0:422060928e37 103 void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t);
donatien 0:422060928e37 104
donatien 0:422060928e37 105 #endif /* LWIP_ICMP */
donatien 0:422060928e37 106
donatien 0:422060928e37 107 #ifdef __cplusplus
donatien 0:422060928e37 108 }
donatien 0:422060928e37 109 #endif
donatien 0:422060928e37 110
donatien 0:422060928e37 111 #endif /* __LWIP_ICMP_H__ */