]>
The Tcpdump Group git mirrors - tcpdump/blob - print-arista.c
1 // Copyright (c) 2018 Arista Networks, Inc. All rights reserved.
7 #include <netdissect-stdinc.h>
11 #include "netdissect.h"
12 #include "interface.h"
14 #include "addrtoname.h"
16 #define ARISTA_SUBTYPE_TIMESTAMP 0x01
18 #define ARISTA_TIMESTAMP_V1 0x10
19 #define ARISTA_TIMESTAMP_V2 0x20
22 arista_print_ethertype(netdissect_options
*ndo
, const u_char
*bp
, u_int len _U_
)
26 u_short bytesConsumed
= 0;
29 ndo
->ndo_protocol
= "arista";
31 subTypeId
= GET_BE_U_2(bp
);
33 version
= GET_BE_U_2(bp
);
37 ND_PRINT("SubType: 0x%1X, Version: 0x%02x, ", subTypeId
, version
);
39 // TapAgg Header Timestamping
40 if (subTypeId
== ARISTA_SUBTYPE_TIMESTAMP
) {
41 // Timestamp has 32-bit lsb in nanosec and remaining msb in sec
44 case ARISTA_TIMESTAMP_V1
:
45 ND_PRINT("Timestamp TAI(64-bit)");
46 ND_PRINT(": Seconds: %u,", GET_BE_U_4(bp
));
47 ND_PRINT(" Nanoseconds: %u, ", GET_BE_U_4(bp
+ 4));
48 bytesConsumed
+= size
+ 8;
50 case ARISTA_TIMESTAMP_V2
:
51 ND_PRINT("Timestamp (48-bit)");
52 ND_PRINT(": Seconds %u,", GET_BE_U_2(bp
));
53 ND_PRINT(" Nanoseconds %u, ", GET_BE_U_4(bp
+ 2));
54 bytesConsumed
+= size
+ 6;
57 ND_PRINT("Unknown timestamp Version 0x%02X ", version
);