58 lines
2.4 KiB
C
58 lines
2.4 KiB
C
// -------------------------------------------------------------------------
|
|
// ipv4.h
|
|
//
|
|
// 21.12.2003, J. Ahrensfeld
|
|
//
|
|
// -------------------------------------------------------------------------
|
|
#ifndef ICMP_H
|
|
#define ICMP_H
|
|
|
|
#include "libsys.h"
|
|
#include "ethernet.h"
|
|
|
|
// -------------------------------------------------------------------------
|
|
typedef struct _sICMP
|
|
{
|
|
uint8_t type;
|
|
uint8_t icmp_code;
|
|
uint16_t hdr_chksum;
|
|
uint16_t data_hdr[2];
|
|
|
|
} __attribute__ ((__packed__)) ICMP;
|
|
|
|
|
|
#define ICMP_ECHO_REPLY 0 // Echo reply.
|
|
#define ICMP_DST_UNREACH 3 // Destination unreachable.
|
|
#define ICMP_SRC_QUENCH 4 // Source quench.
|
|
#define ICMP_REDIRECT 5 // Redirect.
|
|
#define ICMP_ALT_HOST_ADDR 6 // Alternate Host Address.
|
|
#define ICMP_ECHO_REQUEST 8 // Echo request.
|
|
#define ICMP_ROUTER_ADVERTISE 9 // Router advertisement.
|
|
#define ICMP_ROUTER_SOLIC 10 // Router solicitation.
|
|
#define ICMP_TIME_EXCEEDED 11 // Time exceeded.
|
|
#define ICMP_PARAM_PROBLEM 12 // Parameter problem.
|
|
#define ICMP_TIMESTAMP_REQUEST 13 // Timestamp request.
|
|
#define ICMP_TIMESTAMP_REPLY 14 // Timestamp reply.
|
|
#define ICMP_INFO_REQUEST 15 // Information request.
|
|
#define ICMP_INFO_RPLY 16 // Information reply.
|
|
#define ICMP_ADDR_MASK_REQUEST 17 // Address mask request.
|
|
#define ICMP_ADDR_MASK_REPLY 18 // Address mask reply.
|
|
#define ICMP_TRACEROUTE 30 // Traceroute.
|
|
#define ICMP_CONV_ERROR 31 // Conversion error.
|
|
#define ICMP_MOB_HOST_REDIRECT 32 // Mobile Host Redirect.
|
|
#define ICMP_IPV6_WAY 33 // IPv6 Where-Are-You.
|
|
#define ICMP_IPV6_IAH 34 // IPv6 I-Am-Here.
|
|
#define ICMP_MOB_REG_REQUEST 35 // Mobile Registration Request.
|
|
#define ICMP_MOB_REG_REPLY 36 // Mobile Registration Reply.
|
|
#define ICMP_DOM_NAME_REQUEST 37 // Domain Name request.
|
|
#define ICMP_DOM_NAME_REPLY 38 // Domain Name reply.
|
|
#define ICMP_SKIP_ADP 39 // SKIP Algorithm Discovery Protocol.
|
|
#define ICMP_PHOTURIS 40 // Photuris, Security failures.
|
|
|
|
// -------------------------------------------------------------------------
|
|
void ICMPSendRequest(packet_t *pPacket, uint8_t *inet_addr_src, uint8_t *inet_addr_dst, uint8_t *icmp_payload, uint16_t len);
|
|
void ICMPSendReply(packet_t *pPacket, uint8_t *inet_addr_src, uint8_t *inet_addr_dst, ICMP *pICMP, uint8_t *icmp_payload, uint16_t len);
|
|
|
|
// -------------------------------------------------------------------------
|
|
#endif // ICMP_H
|