*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
#include <stdio.h>
-#include "interface.h"
+#include "netdissect.h"
#include "extract.h"
#include "ether.h"
#include "addrtoname.h"
#include "af.h"
struct cfm_common_header_t {
- u_int8_t mdlevel_version;
- u_int8_t opcode;
- u_int8_t flags;
- u_int8_t first_tlv_offset;
+ uint8_t mdlevel_version;
+ uint8_t opcode;
+ uint8_t flags;
+ uint8_t first_tlv_offset;
};
#define CFM_VERSION 0
* Message Formats.
*/
struct cfm_ccm_t {
- u_int8_t sequence[4];
- u_int8_t ma_epi[2];
- u_int8_t md_nameformat;
- u_int8_t md_namelength;
- u_int8_t md_name[46]; /* md name and short ma name */
- u_int8_t reserved_itu[16];
- u_int8_t reserved[6];
+ uint8_t sequence[4];
+ uint8_t ma_epi[2];
+ uint8_t md_nameformat;
+ uint8_t md_namelength;
+ uint8_t md_name[46]; /* md name and short ma name */
+ uint8_t reserved_itu[16];
+ uint8_t reserved[6];
};
/*
};
struct cfm_lbm_t {
- u_int8_t transaction_id[4];
- u_int8_t reserved[4];
+ uint8_t transaction_id[4];
+ uint8_t reserved[4];
};
struct cfm_ltm_t {
- u_int8_t transaction_id[4];
- u_int8_t egress_id[8];
- u_int8_t ttl;
- u_int8_t original_mac[ETHER_ADDR_LEN];
- u_int8_t target_mac[ETHER_ADDR_LEN];
- u_int8_t reserved[3];
+ uint8_t transaction_id[4];
+ uint8_t egress_id[8];
+ uint8_t ttl;
+ uint8_t original_mac[ETHER_ADDR_LEN];
+ uint8_t target_mac[ETHER_ADDR_LEN];
+ uint8_t reserved[3];
};
static const struct tok cfm_ltm_flag_values[] = {
};
struct cfm_ltr_t {
- u_int8_t transaction_id[4];
- u_int8_t last_egress_id[8];
- u_int8_t next_egress_id[8];
- u_int8_t ttl;
- u_int8_t replay_action;
- u_int8_t reserved[6];
+ uint8_t transaction_id[4];
+ uint8_t last_egress_id[8];
+ uint8_t next_egress_id[8];
+ uint8_t ttl;
+ uint8_t replay_action;
+ uint8_t reserved[6];
};
static const struct tok cfm_ltr_flag_values[] = {
*/
struct cfm_tlv_header_t {
- u_int8_t type;
- u_int8_t length[2];
+ uint8_t type;
+ uint8_t length[2];
};
/* FIXME define TLV formats */
static int
cfm_mgmt_addr_print(netdissect_options *ndo,
- register const u_char *tptr) {
-
+ register const u_char *tptr)
+{
u_int mgmt_addr_type;
u_int hexdump = FALSE;
*/
switch(mgmt_addr_type) {
case AFNUM_INET:
- ND_PRINT((ndo, ", %s", ipaddr_string(tptr + 1)));
+ ND_PRINT((ndo, ", %s", ipaddr_string(ndo, tptr + 1)));
break;
-#ifdef INET6
case AFNUM_INET6:
- ND_PRINT((ndo, ", %s", ip6addr_string(tptr + 1)));
+ ND_PRINT((ndo, ", %s", ip6addr_string(ndo, tptr + 1)));
break;
-#endif
default:
hexdump = TRUE;
* The egress-ID string is a 16-Bit string plus a MAC address.
*/
static const char *
-cfm_egress_id_string(register const u_char *tptr) {
+cfm_egress_id_string(netdissect_options *ndo, register const u_char *tptr)
+{
static char egress_id_buffer[80];
snprintf(egress_id_buffer, sizeof(egress_id_buffer),
"MAC 0x%4x-%s",
EXTRACT_16BITS(tptr),
- etheraddr_string(tptr+2));
+ etheraddr_string(ndo, tptr+2));
return egress_id_buffer;
}
void
cfm_print(netdissect_options *ndo,
- register const u_char *pptr, register u_int length) {
-
+ register const u_char *pptr, register u_int length)
+{
const struct cfm_common_header_t *cfm_common_header;
const struct cfm_tlv_header_t *cfm_tlv_header;
- const u_int8_t *tptr, *tlv_ptr, *ma_name, *ma_nameformat, *ma_namelength;
+ const uint8_t *tptr, *tlv_ptr, *ma_name, *ma_nameformat, *ma_namelength;
u_int hexdump, tlen, cfm_tlv_len, cfm_tlv_type, ccm_interval;
break;
case CFM_CCM_MD_FORMAT_MAC:
- ND_PRINT((ndo, "\n\t MAC %s", etheraddr_string(
+ ND_PRINT((ndo, "\n\t MAC %s", etheraddr_string(ndo,
msg_ptr.cfm_ccm->md_name)));
break;
ND_PRINT((ndo, "\n\t Transaction-ID 0x%08x, Egress-ID %s, ttl %u",
EXTRACT_32BITS(msg_ptr.cfm_ltm->transaction_id),
- cfm_egress_id_string(msg_ptr.cfm_ltm->egress_id),
+ cfm_egress_id_string(ndo, msg_ptr.cfm_ltm->egress_id),
msg_ptr.cfm_ltm->ttl));
ND_PRINT((ndo, "\n\t Original-MAC %s, Target-MAC %s",
- etheraddr_string(msg_ptr.cfm_ltm->original_mac),
- etheraddr_string(msg_ptr.cfm_ltm->target_mac)));
+ etheraddr_string(ndo, msg_ptr.cfm_ltm->original_mac),
+ etheraddr_string(ndo, msg_ptr.cfm_ltm->target_mac)));
break;
case CFM_OPCODE_LTR:
ND_PRINT((ndo, "\n\t Transaction-ID 0x%08x, Last-Egress-ID %s",
EXTRACT_32BITS(msg_ptr.cfm_ltr->transaction_id),
- cfm_egress_id_string(msg_ptr.cfm_ltr->last_egress_id)));
+ cfm_egress_id_string(ndo, msg_ptr.cfm_ltr->last_egress_id)));
ND_PRINT((ndo, "\n\t Next-Egress-ID %s, ttl %u",
- cfm_egress_id_string(msg_ptr.cfm_ltr->next_egress_id),
+ cfm_egress_id_string(ndo, msg_ptr.cfm_ltr->next_egress_id),
msg_ptr.cfm_ltr->ttl));
ND_PRINT((ndo, "\n\t Replay-Action %s (%u)",
switch (chassis_id_type) {
case CFM_CHASSIS_ID_MAC_ADDRESS:
- ND_PRINT((ndo, "\n\t MAC %s", etheraddr_string(tptr + 1)));
+ ND_PRINT((ndo, "\n\t MAC %s", etheraddr_string(ndo, tptr + 1)));
break;
case CFM_CHASSIS_ID_NETWORK_ADDRESS: