* POSSIBILITY OF SUCH DAMAGE.
*/
+/* \summary: SunATM DLPI capture printer */
+
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
-#include <tcpdump-stdinc.h>
-
-struct mbuf;
-struct rtentry;
-
-#include <stdio.h>
+#include "netdissect-stdinc.h"
-#include "interface.h"
+#include "netdissect.h"
#include "extract.h"
#include "atm.h"
-#include "atmuni31.h"
/* SunATM header for ATM packet */
#define DIR_POS 0 /* Direction (0x80 = transmit, 0x00 = receive) */
* is the number of bytes actually captured.
*/
u_int
-sunatm_if_print(const struct pcap_pkthdr *h, const u_char *p)
+sunatm_if_print(netdissect_options *ndo,
+ const struct pcap_pkthdr *h, const u_char *p)
{
u_int caplen = h->caplen;
u_int length = h->len;
u_char vpi;
u_int traftype;
+ ndo->ndo_protocol = "sunatm_if";
if (caplen < PKT_BEGIN_POS) {
- printf("[|atm]");
+ nd_print_trunc(ndo);
return (caplen);
}
- if (eflag) {
- if (p[DIR_POS] & 0x80)
- printf("Tx: ");
- else
- printf("Rx: ");
+ if (ndo->ndo_eflag) {
+ ND_PRINT(EXTRACT_U_1(p + DIR_POS) & 0x80 ? "Tx: " : "Rx: ");
}
- switch (p[DIR_POS] & 0x0f) {
+ switch (EXTRACT_U_1(p + DIR_POS) & 0x0f) {
case PT_LANE:
traftype = ATM_LANE;
break;
}
- vci = EXTRACT_16BITS(&p[VCI_POS]);
- vpi = p[VPI_POS];
+ vci = EXTRACT_BE_U_2(p + VCI_POS);
+ vpi = EXTRACT_U_1(p + VPI_POS);
p += PKT_BEGIN_POS;
caplen -= PKT_BEGIN_POS;
length -= PKT_BEGIN_POS;
- atm_print(vpi, vci, traftype, p, length, caplen);
+ atm_print(ndo, vpi, vci, traftype, p, length, caplen);
return (PKT_BEGIN_POS);
}