CDC/ECM driver for mbed, based on USBDevice by mbed-official. Uses PicoTCP to access Ethernet USB device. License: GPLv2
Fork of USB_Ethernet by
pico_icmp4.h
00001 /********************************************************************* 00002 PicoTCP. Copyright (c) 2012 TASS Belgium NV. Some rights reserved. 00003 See LICENSE and COPYING for usage. 00004 00005 . 00006 00007 *********************************************************************/ 00008 #ifndef _INCLUDE_PICO_ICMP4 00009 #define _INCLUDE_PICO_ICMP4 00010 #include "pico_addressing.h" 00011 #include "pico_protocol.h" 00012 00013 extern struct pico_protocol pico_proto_icmp4; 00014 00015 struct __attribute__((packed)) pico_icmp4_hdr { 00016 uint8_t type; 00017 uint8_t code; 00018 uint16_t crc; 00019 00020 /* hun */ 00021 union { 00022 uint8_t ih_pptr; 00023 struct pico_ip4 ih_gwaddr; 00024 struct { 00025 uint16_t idseq_id; 00026 uint16_t idseq_seq; 00027 } ih_idseq; 00028 uint32_t ih_void; 00029 struct { 00030 uint16_t ipm_void; 00031 uint16_t ipm_nmtu; 00032 } ih_pmtu; 00033 struct { 00034 uint8_t rta_numgw; 00035 uint8_t rta_wpa; 00036 uint16_t rta_lifetime; 00037 } ih_rta; 00038 } hun; 00039 00040 /* dun */ 00041 union { 00042 struct { 00043 uint32_t ts_otime; 00044 uint32_t ts_rtime; 00045 uint32_t ts_ttime; 00046 } id_ts; 00047 struct { 00048 uint32_t ip_options; 00049 uint32_t ip_data_hi; 00050 uint32_t ip_data_lo; 00051 } id_ip; 00052 struct { 00053 uint32_t ira_addr; 00054 uint32_t ira_pref; 00055 } id_ra; 00056 uint32_t id_mask; 00057 uint8_t id_data[1]; 00058 } dun; 00059 }; 00060 00061 #define PICO_ICMPHDR_DRY_SIZE 4 00062 #define PICO_ICMPHDR_UN_SIZE 8 00063 00064 #define PICO_ICMP_ECHOREPLY 0 00065 #define PICO_ICMP_DEST_UNREACH 3 00066 #define PICO_ICMP_SOURCE_QUENCH 4 00067 #define PICO_ICMP_REDIRECT 5 00068 #define PICO_ICMP_ECHO 8 00069 #define PICO_ICMP_TIME_EXCEEDED 11 00070 #define PICO_ICMP_PARAMETERPROB 12 00071 #define PICO_ICMP_TIMESTAMP 13 00072 #define PICO_ICMP_TIMESTAMPREPLY 14 00073 #define PICO_ICMP_INFO_REQUEST 15 00074 #define PICO_ICMP_INFO_REPLY 16 00075 #define PICO_ICMP_ADDRESS 17 00076 #define PICO_ICMP_ADDRESSREPLY 18 00077 00078 00079 #define PICO_ICMP_UNREACH 3 00080 #define PICO_ICMP_SOURCEQUENCH 4 00081 #define PICO_ICMP_ROUTERADVERT 9 00082 #define PICO_ICMP_ROUTERSOLICIT 10 00083 #define PICO_ICMP_TIMXCEED 11 00084 #define PICO_ICMP_PARAMPROB 12 00085 #define PICO_ICMP_TSTAMP 13 00086 #define PICO_ICMP_TSTAMPREPLY 14 00087 #define PICO_ICMP_IREQ 15 00088 #define PICO_ICMP_IREQREPLY 16 00089 #define PICO_ICMP_MASKREQ 17 00090 #define PICO_ICMP_MASKREPLY 18 00091 00092 #define PICO_ICMP_MAXTYPE 18 00093 00094 00095 #define PICO_ICMP_UNREACH_NET 0 00096 #define PICO_ICMP_UNREACH_HOST 1 00097 #define PICO_ICMP_UNREACH_PROTOCOL 2 00098 #define PICO_ICMP_UNREACH_PORT 3 00099 #define PICO_ICMP_UNREACH_NEEDFRAG 4 00100 #define PICO_ICMP_UNREACH_SRCFAIL 5 00101 #define PICO_ICMP_UNREACH_NET_UNKNOWN 6 00102 #define PICO_ICMP_UNREACH_HOST_UNKNOWN 7 00103 #define PICO_ICMP_UNREACH_ISOLATED 8 00104 #define PICO_ICMP_UNREACH_NET_PROHIB 9 00105 #define PICO_ICMP_UNREACH_HOST_PROHIB 10 00106 #define PICO_ICMP_UNREACH_TOSNET 11 00107 #define PICO_ICMP_UNREACH_TOSHOST 12 00108 #define PICO_ICMP_UNREACH_FILTER_PROHIB 13 00109 #define PICO_ICMP_UNREACH_HOST_PRECEDENCE 14 00110 #define PICO_ICMP_UNREACH_PRECEDENCE_CUTOFF 15 00111 00112 00113 #define PICO_ICMP_REDIRECT_NET 0 00114 #define PICO_ICMP_REDIRECT_HOST 1 00115 #define PICO_ICMP_REDIRECT_TOSNET 2 00116 #define PICO_ICMP_REDIRECT_TOSHOST 3 00117 00118 00119 #define PICO_ICMP_TIMXCEED_INTRANS 0 00120 #define PICO_ICMP_TIMXCEED_REASS 1 00121 00122 00123 #define PICO_ICMP_PARAMPROB_OPTABSENT 1 00124 00125 #define PICO_SIZE_ICMP4HDR ((sizeof(struct pico_icmp4_hdr))) 00126 00127 struct pico_icmp4_stats 00128 { 00129 struct pico_ip4 dst; 00130 unsigned long size; 00131 unsigned long seq; 00132 unsigned long time; 00133 unsigned long ttl; 00134 int err; 00135 }; 00136 00137 int pico_icmp4_port_unreachable(struct pico_frame *f); 00138 int pico_icmp4_proto_unreachable(struct pico_frame *f); 00139 int pico_icmp4_dest_unreachable(struct pico_frame *f); 00140 int pico_icmp4_ttl_expired(struct pico_frame *f); 00141 int pico_icmp4_packet_filtered(struct pico_frame *f); 00142 00143 int pico_icmp4_ping(char *dst, int count, int interval, int timeout, int size, void (*cb)(struct pico_icmp4_stats *)); 00144 #define PICO_PING_ERR_REPLIED 0 00145 #define PICO_PING_ERR_TIMEOUT 1 00146 #define PICO_PING_ERR_UNREACH 2 00147 #define PICO_PING_ERR_PENDING 0xFFFF 00148 00149 #endif
Generated on Wed Jul 13 2022 02:20:45 by 1.7.2