wireshark/epan/afn.h

89 lines
3.8 KiB
C
Raw Permalink Normal View History

/** @file
*
There is really no need to have the BGP dissector and the LDP dissector have two independent "value_string" tables mapping RFC 1700 address family numbers to names, nor is there any need to have the BGP dissector and the PIM dissector have two independent sets of #defines for RFC 1700 address family numbers; put a single "value_string" table in "afn.c" and put a declaration of it, and #defines for the address family numbers, into "afn.h", and have the dissectors use that. Move the #define for PGM into "ipproto.h", and add an entry for it in the "value_string" table in "ipproto.c". Have the PGM dissector use the standard Ethereal mechanisms for resolving addresses, and have it use "value_string" tables for mapping option types, the OPX bits, and packet types to strings. Use "bytes_to_str()" to turn byte arrays into strings of hex digits. Pass the packet type string to "dissect_pgmopts()" as an argument, rather than making it a global. Don't use "proto_tree_add_XXX_format" routines if you can possibly just use "proto_tree_add_XXX"; give various fields the correct radix and type, and VALS() strings if necessary, to make that happen (and to make filtering on them more pleasant). Put the type, length, and total length of the options into the protocol tree as separate fields. Don't have separate type, length, and OPX fields for every type of option; one field will suffice. Don't format a string with "sprintf()" and then pass that string to "col_add_fstr()" with a format of "%s" and the string as an argument - "col_add_fstr()" can format strings itself (that's what the "f" stands for). Don't byte-swap and then un-byte-swap IPv4 address fields in the header, just leave them network byte order to start with. Use the correct fields for "proto_tree_add_XXX", rather than using the same field multiple times. Quit early if an address family identifier isn't AFNUM_INET, as that means the structure we use to dissect the header doesn't match the actual header. svn path=/trunk/; revision=3761
2001-07-21 10:27:13 +00:00
* RFC 1700 address family numbers
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
There is really no need to have the BGP dissector and the LDP dissector have two independent "value_string" tables mapping RFC 1700 address family numbers to names, nor is there any need to have the BGP dissector and the PIM dissector have two independent sets of #defines for RFC 1700 address family numbers; put a single "value_string" table in "afn.c" and put a declaration of it, and #defines for the address family numbers, into "afn.h", and have the dissectors use that. Move the #define for PGM into "ipproto.h", and add an entry for it in the "value_string" table in "ipproto.c". Have the PGM dissector use the standard Ethereal mechanisms for resolving addresses, and have it use "value_string" tables for mapping option types, the OPX bits, and packet types to strings. Use "bytes_to_str()" to turn byte arrays into strings of hex digits. Pass the packet type string to "dissect_pgmopts()" as an argument, rather than making it a global. Don't use "proto_tree_add_XXX_format" routines if you can possibly just use "proto_tree_add_XXX"; give various fields the correct radix and type, and VALS() strings if necessary, to make that happen (and to make filtering on them more pleasant). Put the type, length, and total length of the options into the protocol tree as separate fields. Don't have separate type, length, and OPX fields for every type of option; one field will suffice. Don't format a string with "sprintf()" and then pass that string to "col_add_fstr()" with a format of "%s" and the string as an argument - "col_add_fstr()" can format strings itself (that's what the "f" stands for). Don't byte-swap and then un-byte-swap IPv4 address fields in the header, just leave them network byte order to start with. Use the correct fields for "proto_tree_add_XXX", rather than using the same field multiple times. Quit early if an address family identifier isn't AFNUM_INET, as that means the structure we use to dissect the header doesn't match the actual header. svn path=/trunk/; revision=3761
2001-07-21 10:27:13 +00:00
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
There is really no need to have the BGP dissector and the LDP dissector have two independent "value_string" tables mapping RFC 1700 address family numbers to names, nor is there any need to have the BGP dissector and the PIM dissector have two independent sets of #defines for RFC 1700 address family numbers; put a single "value_string" table in "afn.c" and put a declaration of it, and #defines for the address family numbers, into "afn.h", and have the dissectors use that. Move the #define for PGM into "ipproto.h", and add an entry for it in the "value_string" table in "ipproto.c". Have the PGM dissector use the standard Ethereal mechanisms for resolving addresses, and have it use "value_string" tables for mapping option types, the OPX bits, and packet types to strings. Use "bytes_to_str()" to turn byte arrays into strings of hex digits. Pass the packet type string to "dissect_pgmopts()" as an argument, rather than making it a global. Don't use "proto_tree_add_XXX_format" routines if you can possibly just use "proto_tree_add_XXX"; give various fields the correct radix and type, and VALS() strings if necessary, to make that happen (and to make filtering on them more pleasant). Put the type, length, and total length of the options into the protocol tree as separate fields. Don't have separate type, length, and OPX fields for every type of option; one field will suffice. Don't format a string with "sprintf()" and then pass that string to "col_add_fstr()" with a format of "%s" and the string as an argument - "col_add_fstr()" can format strings itself (that's what the "f" stands for). Don't byte-swap and then un-byte-swap IPv4 address fields in the header, just leave them network byte order to start with. Use the correct fields for "proto_tree_add_XXX", rather than using the same field multiple times. Quit early if an address family identifier isn't AFNUM_INET, as that means the structure we use to dissect the header doesn't match the actual header. svn path=/trunk/; revision=3761
2001-07-21 10:27:13 +00:00
*/
#ifndef __AFN_H__
#define __AFN_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* Address family numbers, from
*
* http://www.iana.org/assignments/address-family-numbers
*/
#define AFNUM_RESERVED 0 /* Reserved */
#define AFNUM_INET 1 /* IP (IP version 4) */
#define AFNUM_INET6 2 /* IP6 (IP version 6) */
#define AFNUM_NSAP 3 /* NSAP */
#define AFNUM_HDLC 4 /* HDLC (8-bit multidrop) */
#define AFNUM_BBN1822 5 /* BBN 1822 */
#define AFNUM_802 6 /* 802 (includes all 802 media plus Ethernet "canonical format") */
#define AFNUM_E163 7 /* E.163 */
#define AFNUM_E164 8 /* E.164 (SMDS, Frame Relay, ATM) */
#define AFNUM_F69 9 /* F.69 (Telex) */
#define AFNUM_X121 10 /* X.121 (X.25, Frame Relay) */
#define AFNUM_IPX 11 /* IPX */
#define AFNUM_ATALK 12 /* Appletalk */
#define AFNUM_DECNET 13 /* Decnet IV */
#define AFNUM_BANYAN 14 /* Banyan Vines */
#define AFNUM_E164NSAP 15 /* E.164 with NSAP format subaddress */
#define AFNUM_DNS 16 /* DNS (Domain Name System) */
#define AFNUM_DISTNAME 17 /* Distinguished Name */
#define AFNUM_AS_NUMBER 18 /* AS Number */
#define AFNUM_XTP_IP4 19 /* XTP over IP version 4 */
#define AFNUM_XTP_IP6 20 /* XTP over IP version 6 */
#define AFNUM_XTP 21 /* XTP native mode XTP */
#define AFNUM_FC_WWPN 22 /* Fibre Channel World-Wide Port Name */
#define AFNUM_FC_WWNN 23 /* Fibre Channel World-Wide Node Name */
#define AFNUM_GWID 24 /* GWID */
#define AFNUM_L2VPN 25 /* RFC4761 RFC6074 */
#define AFNUM_L2VPN_OLD 196
#define AFNUM_MPLS_TP_SEI 26 /* MPLS-TP Section Endpoint Identifier, RFC7212 */
#define AFNUM_MPLS_TP_LSPEI 27 /* MPLS-TP LSP Endpoint Identifier, RFC7212 */
#define AFNUM_MPLS_TP_PEI 28 /* MPLS-TP Pseudowire Endpoint Identifier, RFC7212 */
#define AFNUM_MT_IP 29 /* MT IP: Multi-Topology IP version 4, RFC7307 */
#define AFNUM_MT_IPV6 30 /* MT IPv6: Multi-Topology IP version 6, RFC7307 */
#define AFNUM_EIGRP_COMMON 16384 /* EIGRP Common Service Family, Donnie Savage */
#define AFNUM_EIGRP_IPV4 16385 /* EIGRP IPv4 Service Family, Donnie Savage */
#define AFNUM_EIGRP_IPV6 16386 /* EIGRP IPv6 Service Family, Donnie Savage */
#define AFNUM_LCAF 16387 /* LISP Canonical Address Format, David Meyer */
#define AFNUM_BGP_LS 16388 /* BGP-LS, RFC7752 */
#define AFNUM_EUI48 16389 /* 48-bit MAC, RFC7042 */
#define AFNUM_EUI64 16390 /* 64-bit MAC, RFC7042 */
#define AFNUM_OUI 16391 /* OUI, RFC7961 */
#define AFNUM_MAC_24 16392 /* MAC/24, RFC7961 */
#define AFNUM_MAC_40 16393 /* MAC/40, RFC7961 */
#define AFNUM_IPv6_64 16394 /* IPv6/64, RFC7961 */
#define AFNUM_RB_PID 16395 /* RBridge Port ID, RFC7961 */
#define AFNUM_TRILL_NICKNAME 16396 /* TRILL Nickname, RFC7455 */
There is really no need to have the BGP dissector and the LDP dissector have two independent "value_string" tables mapping RFC 1700 address family numbers to names, nor is there any need to have the BGP dissector and the PIM dissector have two independent sets of #defines for RFC 1700 address family numbers; put a single "value_string" table in "afn.c" and put a declaration of it, and #defines for the address family numbers, into "afn.h", and have the dissectors use that. Move the #define for PGM into "ipproto.h", and add an entry for it in the "value_string" table in "ipproto.c". Have the PGM dissector use the standard Ethereal mechanisms for resolving addresses, and have it use "value_string" tables for mapping option types, the OPX bits, and packet types to strings. Use "bytes_to_str()" to turn byte arrays into strings of hex digits. Pass the packet type string to "dissect_pgmopts()" as an argument, rather than making it a global. Don't use "proto_tree_add_XXX_format" routines if you can possibly just use "proto_tree_add_XXX"; give various fields the correct radix and type, and VALS() strings if necessary, to make that happen (and to make filtering on them more pleasant). Put the type, length, and total length of the options into the protocol tree as separate fields. Don't have separate type, length, and OPX fields for every type of option; one field will suffice. Don't format a string with "sprintf()" and then pass that string to "col_add_fstr()" with a format of "%s" and the string as an argument - "col_add_fstr()" can format strings itself (that's what the "f" stands for). Don't byte-swap and then un-byte-swap IPv4 address fields in the header, just leave them network byte order to start with. Use the correct fields for "proto_tree_add_XXX", rather than using the same field multiple times. Quit early if an address family identifier isn't AFNUM_INET, as that means the structure we use to dissect the header doesn't match the actual header. svn path=/trunk/; revision=3761
2001-07-21 10:27:13 +00:00
extern const value_string afn_vals[];
#ifdef __cplusplus
}
#endif /* __cplusplus */
There is really no need to have the BGP dissector and the LDP dissector have two independent "value_string" tables mapping RFC 1700 address family numbers to names, nor is there any need to have the BGP dissector and the PIM dissector have two independent sets of #defines for RFC 1700 address family numbers; put a single "value_string" table in "afn.c" and put a declaration of it, and #defines for the address family numbers, into "afn.h", and have the dissectors use that. Move the #define for PGM into "ipproto.h", and add an entry for it in the "value_string" table in "ipproto.c". Have the PGM dissector use the standard Ethereal mechanisms for resolving addresses, and have it use "value_string" tables for mapping option types, the OPX bits, and packet types to strings. Use "bytes_to_str()" to turn byte arrays into strings of hex digits. Pass the packet type string to "dissect_pgmopts()" as an argument, rather than making it a global. Don't use "proto_tree_add_XXX_format" routines if you can possibly just use "proto_tree_add_XXX"; give various fields the correct radix and type, and VALS() strings if necessary, to make that happen (and to make filtering on them more pleasant). Put the type, length, and total length of the options into the protocol tree as separate fields. Don't have separate type, length, and OPX fields for every type of option; one field will suffice. Don't format a string with "sprintf()" and then pass that string to "col_add_fstr()" with a format of "%s" and the string as an argument - "col_add_fstr()" can format strings itself (that's what the "f" stands for). Don't byte-swap and then un-byte-swap IPv4 address fields in the header, just leave them network byte order to start with. Use the correct fields for "proto_tree_add_XXX", rather than using the same field multiple times. Quit early if an address family identifier isn't AFNUM_INET, as that means the structure we use to dissect the header doesn't match the actual header. svn path=/trunk/; revision=3761
2001-07-21 10:27:13 +00:00
#endif /* __AFN_H__ */
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/