Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

icmp.h

Go to the documentation of this file.
00001 /*!     \file include/net/icmp.h
00002  *      \brief ICMP (Internet Control Message Protocol) layer header.
00003  *      \author Andrea Righi <drizzt@inwind.it>
00004  *      \date Last update: 2003-11-09
00005  *      \note Copyright (&copy;) 2003 Andrea Righi
00006  */
00007 
00008 #ifndef ICMP_H
00009 #define ICMP_H
00010 
00011 #include <net/ip.h>
00012 
00013 /** \ingroup Network
00014  *  \defgroup NetICMP ICMP (Internet Control Message Protocol) layer
00015  *  The ICMP (Internet Control Message Protocol) layer.
00016  *  @{
00017  */
00018 
00019 //! Echo Reply.
00020 #define ICMP_ECHOREPLY          0
00021 //! Destination Unreachable.
00022 #define ICMP_DEST_UNREACH       3
00023 //! Source Quench.
00024 #define ICMP_SOURCE_QUENCH      4
00025 //! Redirect (change route).
00026 #define ICMP_REDIRECT           5
00027 //! Echo Request.
00028 #define ICMP_ECHO               8
00029 //! Time Exceeded.
00030 #define ICMP_TIME_EXCEEDED      11
00031 //! Parameter Problem.
00032 #define ICMP_PARAMETERPROB      12
00033 //! Timestamp Request.
00034 #define ICMP_TIMESTAMP          13
00035 //! Timestamp Reply.
00036 #define ICMP_TIMESTAMPREPLY     14
00037 //! Information Request.
00038 #define ICMP_INFO_REQUEST       15
00039 //! Information Reply.
00040 #define ICMP_INFO_REPLY         16
00041 //! Address Mask Request.
00042 #define ICMP_ADDRESS            17
00043 //! Address Mask Reply.
00044 #define ICMP_ADDRESSREPLY       18
00045 
00046 //! Network Unreachable.
00047 #define ICMP_NET_UNREACH        0
00048 //! Host Unreachable.
00049 #define ICMP_HOST_UNREACH       1
00050 //! Protocol Unreachable.
00051 #define ICMP_PROT_UNREACH       2
00052 //! Port Unreachable.
00053 #define ICMP_PORT_UNREACH       3
00054 //! Fragmentation Needed/DF set.
00055 #define ICMP_FRAG_NEEDED        4
00056 //! Source Route failed.
00057 #define ICMP_SR_FAILED          5
00058 //! Network Unknown.
00059 #define ICMP_NET_UNKNOWN        6
00060 //! Host Unknown.
00061 #define ICMP_HOST_UNKNOWN       7
00062 //! Host isolated.
00063 #define ICMP_HOST_ISOLATED      8
00064 
00065 #define ICMP_NET_ANO            9
00066 #define ICMP_HOST_ANO           10
00067 #define ICMP_NET_UNR_TOS        11
00068 #define ICMP_HOST_UNR_TOS       12
00069 
00070 //! Packet Filtered.
00071 #define ICMP_PKT_FILTERED       13
00072 //! Precedence Violation.
00073 #define ICMP_PREC_VIOLATION     14
00074 //! Precedence Cut Off.
00075 #define ICMP_PREC_CUTOFF        15
00076 
00077 //! Redirect Net.
00078 #define ICMP_REDIR_NET          0
00079 //! Redirect Host.
00080 #define ICMP_REDIR_HOST         1
00081 //! Redirect Net for TOS.
00082 #define ICMP_REDIR_NETTOS       2
00083 //! Redirect Host for TOS.
00084 #define ICMP_REDIR_HOSTTOS      3
00085 
00086 //! TTL cound exceeded.
00087 #define ICMP_EXC_TTL            0
00088 //! Fragment Reass Time exceeeded.
00089 #define ICMP_EXC_FRAGTIME       1
00090 
00091 //! ICMP packet structure.
00092 typedef struct icmp
00093 {
00094         //! ICMP message type.
00095         uint8_t icmp_type;
00096         //! ICMP operation code.
00097         uint8_t icmp_code;
00098         //! ICMP checksum.
00099         uint16_t icmp_chk;
00100 } __attribute__ ((packed)) icmp_t;
00101 
00102 //! ICMP::PING packet structure.
00103 typedef struct icmp_ping
00104 {
00105         //! The ICMP header.
00106         icmp_t ping_icmp;
00107         //! The PING id.
00108         uint16_t ping_id;
00109         //! The PING sequence number.
00110         uint16_t ping_seq;
00111 } __attribute__ ((packed)) icmp_ping_t;
00112 
00113 // --- Prototypes ----------------------------------------------------- //
00114 
00115 void to_icmp_layer(ip_t *packet);
00116 int send_icmp_packet(in_addr_t ip_to, uint8_t message, uint8_t *data, size_t len);
00117 void ping(char *ip_dot);
00118 
00119 /** @} */ // end of NetICMP
00120 
00121 #endif

Generated on Fri Feb 20 15:32:15 2004 for Minirighi by doxygen1.2.18