|
| 1 | +// |
| 2 | +// Copyright (C) 2000 Institut fuer Telematik, Universitaet Karlsruhe |
| 3 | +// Copyright (C) 2004 OpenSim Ltd. |
| 4 | +// |
| 5 | +// SPDX-License-Identifier: LGPL-3.0-or-later |
| 6 | +// |
| 7 | + |
| 8 | +import inet.common.INETDefs; |
| 9 | + |
| 10 | +namespace inet; |
| 11 | + |
| 12 | +// |
| 13 | +// The real ICMP codes |
| 14 | +// |
| 15 | +enum IcmpType |
| 16 | +{ |
| 17 | + |
| 18 | + ICMP_DESTINATION_UNREACHABLE = 3; |
| 19 | + ICMP_SOURCEQUENCH = 4; // packet lost, slow down |
| 20 | + ICMP_REDIRECT = 5; |
| 21 | + ICMP_ECHO_REQUEST = 8; |
| 22 | + ICMP_ROUTER_ADVERTISEMENT = 9; // router advertisement |
| 23 | + ICMP_ROUTER_SOLICITATION = 10; // router solicitation |
| 24 | + ICMP_TIME_EXCEEDED = 11; |
| 25 | + ICMP_PARAMETER_PROBLEM = 12; |
| 26 | + |
| 27 | + ICMP_ECHO_REPLY = 0; |
| 28 | + ICMP_TIMESTAMP_REQUEST = 13; |
| 29 | + ICMP_TIMESTAMP_REPLY = 14; |
| 30 | + ICMP_INFORMATION_REQUEST = 15; // information request |
| 31 | + ICMP_INFORMATION_REPLY = 16; // information reply |
| 32 | + ICMP_MASK_REQUEST = 17; // address mask request |
| 33 | + ICMP_MASK_REPLY = 18; // address mask reply |
| 34 | +} |
| 35 | + |
| 36 | +enum IcmpRedirectSubcodes |
| 37 | +{ |
| 38 | + ICMP_REDIRECT_NET = 0; // for network |
| 39 | + ICMP_REDIRECT_HOST = 1; // for host |
| 40 | + ICMP_REDIRECT_TOSNET = 2; // for tos and net |
| 41 | + ICMP_REDIRECT_TOSHOST = 3; // for tos and host |
| 42 | +} |
| 43 | + |
| 44 | +enum IcmpTimeExceededSubcodes |
| 45 | +{ |
| 46 | + ICMP_TIMXCEED_INTRANS = 0; // ttl==0 in transit |
| 47 | + ICMP_TIMXCEED_REASS = 1; // ttl==0 in reass |
| 48 | +} |
| 49 | + |
| 50 | +enum IcmpParameterProblemSubcodes |
| 51 | +{ |
| 52 | + ICMP_PARAMPROB_ERRATPTR = 0; // error at param ptr |
| 53 | + ICMP_PARAMPROB_OPTABSENT = 1; // req. opt. absent |
| 54 | + ICMP_PARAMPROB_LENGTH = 2; // bad length |
| 55 | +} |
| 56 | + |
| 57 | +// |
| 58 | +// Codes for type ICMP_DESTINATION_UNREACHABLE |
| 59 | +// |
| 60 | +enum IcmpDestinationUnreachableCodes |
| 61 | +{ |
| 62 | + ICMP_DU_NETWORK_UNREACHABLE = 0; |
| 63 | + ICMP_DU_HOST_UNREACHABLE = 1; |
| 64 | + ICMP_DU_PROTOCOL_UNREACHABLE = 2; |
| 65 | + ICMP_DU_PORT_UNREACHABLE = 3; |
| 66 | + ICMP_DU_FRAGMENTATION_NEEDED = 4; |
| 67 | + ICMP_DU_SOURCE_ROUTE_FAILED = 5; |
| 68 | + ICMP_DU_DESTINATION_NETWORK_UNKNOWN = 6; |
| 69 | + ICMP_DU_DESTINATION_HOST_UNKNOWN = 7; |
| 70 | + ICMP_DU_SOURCE_HOST_ISOLATED = 8; |
| 71 | + ICMP_DU_NETWORK_PROHIBITED = 9; |
| 72 | + ICMP_DU_HOST_PROHIBITED = 10; |
| 73 | + ICMP_DU_NETWORK_UNREACHABLE_FOR_TYPE_OF_SERVICE = 11; |
| 74 | + ICMP_DU_HOST_UNREACHABLE_FOR_TYPE_OF_SERVICE = 12; |
| 75 | + ICMP_DU_COMMUNICATION_PROHIBITED = 13; |
| 76 | + ICMP_DU_HOST_PRECEDENCE_VIOLATION = 14; |
| 77 | + ICMP_DU_PRECEDENCE_CUTOFF_IN_EFFECT = 15; |
| 78 | + ICMP_AODV_QUEUE_FULL = 16; |
| 79 | +} |
| 80 | + |
| 81 | +cplusplus {{ |
| 82 | +typedef int IcmpCode; |
| 83 | + |
| 84 | +inline bool isIcmpInfoType(int type) |
| 85 | +{ |
| 86 | + return (type == ICMP_ECHO_REPLY |
| 87 | + || type == ICMP_ECHO_REQUEST |
| 88 | + || type == ICMP_ROUTER_ADVERTISEMENT |
| 89 | + || type == ICMP_ROUTER_SOLICITATION |
| 90 | + || type == ICMP_TIMESTAMP_REQUEST |
| 91 | + || type == ICMP_TIMESTAMP_REPLY |
| 92 | + || type == ICMP_INFORMATION_REQUEST |
| 93 | + || type == ICMP_INFORMATION_REPLY |
| 94 | + || type == ICMP_MASK_REQUEST |
| 95 | + || type == ICMP_MASK_REPLY); |
| 96 | +} |
| 97 | + |
| 98 | +}} |
0 commit comments