199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright(c) 1982, 1986, 1990, 1993 399a2dd95SBruce Richardson * The Regents of the University of California. 499a2dd95SBruce Richardson * Copyright(c) 2013 6WIND S.A. 599a2dd95SBruce Richardson * All rights reserved. 699a2dd95SBruce Richardson */ 799a2dd95SBruce Richardson 899a2dd95SBruce Richardson #ifndef _RTE_ICMP_H_ 999a2dd95SBruce Richardson #define _RTE_ICMP_H_ 1099a2dd95SBruce Richardson 1199a2dd95SBruce Richardson /** 1299a2dd95SBruce Richardson * @file 1399a2dd95SBruce Richardson * 1499a2dd95SBruce Richardson * ICMP-related defines 1599a2dd95SBruce Richardson */ 1699a2dd95SBruce Richardson 1799a2dd95SBruce Richardson #include <stdint.h> 1899a2dd95SBruce Richardson 1999a2dd95SBruce Richardson #include <rte_byteorder.h> 2099a2dd95SBruce Richardson 2199a2dd95SBruce Richardson /** 22750ee81dSLeo Xu * ICMP base header 23750ee81dSLeo Xu */ 24*fba98755SAndre Muezerie struct __rte_packed_begin rte_icmp_base_hdr { 25750ee81dSLeo Xu uint8_t type; 26750ee81dSLeo Xu uint8_t code; 27750ee81dSLeo Xu rte_be16_t checksum; 28*fba98755SAndre Muezerie } __rte_packed_end; 29750ee81dSLeo Xu 30750ee81dSLeo Xu /** 31750ee81dSLeo Xu * ICMP echo header 32750ee81dSLeo Xu */ 33*fba98755SAndre Muezerie struct __rte_packed_begin rte_icmp_echo_hdr { 34750ee81dSLeo Xu struct rte_icmp_base_hdr base; 35750ee81dSLeo Xu rte_be16_t identifier; 36750ee81dSLeo Xu rte_be16_t sequence; 37*fba98755SAndre Muezerie } __rte_packed_end; 38750ee81dSLeo Xu 39750ee81dSLeo Xu /** 4099a2dd95SBruce Richardson * ICMP Header 41750ee81dSLeo Xu * 42750ee81dSLeo Xu * @see rte_icmp_echo_hdr which is similar. 4399a2dd95SBruce Richardson */ 44*fba98755SAndre Muezerie struct __rte_packed_begin rte_icmp_hdr { 4599a2dd95SBruce Richardson uint8_t icmp_type; /* ICMP packet type. */ 4699a2dd95SBruce Richardson uint8_t icmp_code; /* ICMP packet code. */ 4799a2dd95SBruce Richardson rte_be16_t icmp_cksum; /* ICMP packet checksum. */ 4899a2dd95SBruce Richardson rte_be16_t icmp_ident; /* ICMP packet identifier. */ 4999a2dd95SBruce Richardson rte_be16_t icmp_seq_nb; /* ICMP packet sequence number. */ 50*fba98755SAndre Muezerie } __rte_packed_end; 5199a2dd95SBruce Richardson 5299a2dd95SBruce Richardson /* ICMP packet types */ 5387bde5aeSRobin Jarry #define RTE_ICMP_TYPE_ECHO_REPLY 0 5487bde5aeSRobin Jarry #define RTE_IP_ICMP_ECHO_REPLY \ 5587bde5aeSRobin Jarry (RTE_DEPRECATED(RTE_IP_ICMP_ECHO_REPLY) RTE_ICMP_TYPE_ECHO_REPLY) 5687bde5aeSRobin Jarry #define RTE_ICMP_TYPE_DEST_UNREACHABLE 3 5787bde5aeSRobin Jarry #define RTE_ICMP_TYPE_REDIRECT 5 5887bde5aeSRobin Jarry #define RTE_ICMP_TYPE_ECHO_REQUEST 8 5987bde5aeSRobin Jarry #define RTE_IP_ICMP_ECHO_REQUEST \ 6087bde5aeSRobin Jarry (RTE_DEPRECATED(RTE_IP_ICMP_ECHO_REQUEST) RTE_ICMP_TYPE_ECHO_REQUEST) 6187bde5aeSRobin Jarry #define RTE_ICMP_TYPE_TTL_EXCEEDED 11 6287bde5aeSRobin Jarry #define RTE_ICMP_TYPE_PARAM_PROBLEM 12 6387bde5aeSRobin Jarry #define RTE_ICMP_TYPE_TIMESTAMP_REQUEST 13 6487bde5aeSRobin Jarry #define RTE_ICMP_TYPE_TIMESTAMP_REPLY 14 6587bde5aeSRobin Jarry 6687bde5aeSRobin Jarry /* Destination Unreachable codes */ 6787bde5aeSRobin Jarry #define RTE_ICMP_CODE_UNREACH_NET 0 6887bde5aeSRobin Jarry #define RTE_ICMP_CODE_UNREACH_HOST 1 6987bde5aeSRobin Jarry #define RTE_ICMP_CODE_UNREACH_PROTO 2 7087bde5aeSRobin Jarry #define RTE_ICMP_CODE_UNREACH_PORT 3 7187bde5aeSRobin Jarry #define RTE_ICMP_CODE_UNREACH_FRAG 4 7287bde5aeSRobin Jarry #define RTE_ICMP_CODE_UNREACH_SRC 5 7387bde5aeSRobin Jarry 7487bde5aeSRobin Jarry /* Time Exceeded codes */ 7587bde5aeSRobin Jarry #define RTE_ICMP_CODE_TTL_EXCEEDED 0 7687bde5aeSRobin Jarry #define RTE_ICMP_CODE_TTL_FRAG 1 7787bde5aeSRobin Jarry 7887bde5aeSRobin Jarry /* Redirect codes */ 7987bde5aeSRobin Jarry #define RTE_ICMP_CODE_REDIRECT_NET 0 8087bde5aeSRobin Jarry #define RTE_ICMP_CODE_REDIRECT_HOST 1 8187bde5aeSRobin Jarry #define RTE_ICMP_CODE_REDIRECT_TOS_NET 2 8287bde5aeSRobin Jarry #define RTE_ICMP_CODE_REDIRECT_TOS_HOST 3 8387bde5aeSRobin Jarry 84750ee81dSLeo Xu #define RTE_ICMP6_ECHO_REQUEST 128 85750ee81dSLeo Xu #define RTE_ICMP6_ECHO_REPLY 129 8699a2dd95SBruce Richardson 8799a2dd95SBruce Richardson #endif /* RTE_ICMP_H_ */ 88