]> The Tcpdump Group git mirrors - tcpdump/blob - print-atalk.c
CI: Add warning exemptions for Sun C (suncc-5.14) on Solaris 10
[tcpdump] / print-atalk.c
1 /*
2 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
16 * written permission.
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 */
21
22 /* \summary: AppleTalk printer */
23
24 #include <config.h>
25
26 #include "netdissect-stdinc.h"
27
28 #include <stdio.h>
29 #include <string.h>
30
31 #define ND_LONGJMP_FROM_TCHECK
32 #include "netdissect.h"
33 #include "addrtoname.h"
34 #include "ethertype.h"
35 #include "extract.h"
36 #include "appletalk.h"
37
38 /* Datagram Delivery Protocol */
39
40 struct atDDP {
41 nd_uint16_t length;
42 nd_uint16_t checksum;
43 nd_uint16_t dstNet;
44 nd_uint16_t srcNet;
45 nd_uint8_t dstNode;
46 nd_uint8_t srcNode;
47 nd_uint8_t dstSkt;
48 nd_uint8_t srcSkt;
49 nd_uint8_t type;
50 };
51 #define ddpSize 13
52
53 struct atShortDDP {
54 nd_uint16_t length;
55 nd_uint8_t dstSkt;
56 nd_uint8_t srcSkt;
57 nd_uint8_t type;
58 };
59 #define ddpSSize 5
60
61 /* AppleTalk Transaction Protocol */
62
63 struct atATP {
64 nd_uint8_t control;
65 nd_uint8_t bitmap;
66 nd_uint16_t transID;
67 nd_uint32_t userData;
68 };
69
70 #define atpReqCode 0x40
71 #define atpRspCode 0x80
72 #define atpRelCode 0xC0
73 #define atpXO 0x20
74 #define atpEOM 0x10
75 #define atpSTS 0x08
76
77 /* Name Binding Protocol */
78
79 struct atNBP {
80 nd_uint8_t control;
81 nd_uint8_t id;
82 };
83 #define nbpHeaderSize 2
84
85 struct atNBPtuple {
86 nd_uint16_t net;
87 nd_uint8_t node;
88 nd_uint8_t skt;
89 nd_uint8_t enumerator;
90 };
91 #define nbpTupleSize 5
92
93 #define nbpBrRq 0x10
94 #define nbpLkUp 0x20
95 #define nbpLkUpReply 0x30
96 static const struct tok nbp_str[] = {
97 { nbpBrRq, "brRq" },
98 { nbpLkUp, "lkup" },
99 { nbpLkUpReply, "reply" },
100 { 0, NULL }
101 };
102
103 #define ddpRTMP 1 /* RTMP type */
104 #define ddpNBP 2 /* NBP type */
105 #define ddpATP 3 /* ATP type */
106 #define ddpECHO 4 /* ECHO type */
107 #define ddpRTMPrequest 5 /* RTMP request type */
108 #define ddpIP 22 /* IP type */
109 #define ddpARP 23 /* ARP type */
110 #define ddpKLAP 0x4b /* Kinetics KLAP type */
111 #define ddpEIGRP 88 /* EIGRP over Appletalk */
112 static const struct tok type2str[] = {
113 { ddpRTMP, "rtmp" },
114 { ddpRTMPrequest, "rtmpReq" },
115 { ddpECHO, "echo" },
116 { ddpIP, "IP" },
117 { ddpARP, "ARP" },
118 { ddpKLAP, "KLAP" },
119 { 0, NULL }
120 };
121
122 struct aarp {
123 nd_uint16_t htype, ptype;
124 nd_uint8_t halen, palen;
125 nd_uint16_t op;
126 nd_mac48 hsaddr;
127 nd_byte psaddr[4];
128 nd_mac48 hdaddr;
129 nd_byte pdaddr[4];
130 };
131
132 static void atp_print(netdissect_options *, const struct atATP *, u_int);
133 static void atp_bitmap_print(netdissect_options *, u_char);
134 static void nbp_print(netdissect_options *, const struct atNBP *, u_int, u_short, u_char, u_char);
135 static const struct atNBPtuple *nbp_tuple_print(netdissect_options *ndo, const struct atNBPtuple *,
136 u_short, u_char, u_char);
137 static const struct atNBPtuple *nbp_name_print(netdissect_options *, const struct atNBPtuple *);
138 static const char *ataddr_string(netdissect_options *, u_short, u_char);
139 static void ddp_print(netdissect_options *, const u_char *, u_int, u_int, u_short, u_char, u_char);
140 static const char *ddpskt_string(netdissect_options *, u_int);
141
142 /*
143 * Print LLAP packets received on a physical LocalTalk interface.
144 */
145 void
146 ltalk_if_print(netdissect_options *ndo,
147 const struct pcap_pkthdr *h, const u_char *p)
148 {
149 ndo->ndo_protocol = "ltalk";
150 ndo->ndo_ll_hdr_len += llap_print(ndo, p, h->len);
151 }
152
153 /*
154 * Print AppleTalk LLAP packets.
155 */
156 u_int
157 llap_print(netdissect_options *ndo,
158 const u_char *bp, u_int length)
159 {
160 const struct LAP *lp;
161 const struct atDDP *dp;
162 const struct atShortDDP *sdp;
163 u_short snet;
164 u_int hdrlen;
165
166 ndo->ndo_protocol = "llap";
167 ND_ICHECKMSG_ZU("LLAP length", length, <, sizeof(*lp));
168 lp = (const struct LAP *)bp;
169 bp += sizeof(*lp);
170 length -= sizeof(*lp);
171 hdrlen = sizeof(*lp);
172 switch (GET_U_1(lp->type)) {
173
174 case lapShortDDP:
175 ndo->ndo_protocol = "sddp";
176 ND_ICHECKMSG_U("SDDP length", length, <, ddpSSize);
177 sdp = (const struct atShortDDP *)bp;
178 ND_PRINT("%s.%s",
179 ataddr_string(ndo, 0, GET_U_1(lp->src)),
180 ddpskt_string(ndo, GET_U_1(sdp->srcSkt)));
181 ND_PRINT(" > %s.%s:",
182 ataddr_string(ndo, 0, GET_U_1(lp->dst)),
183 ddpskt_string(ndo, GET_U_1(sdp->dstSkt)));
184 bp += ddpSSize;
185 length -= ddpSSize;
186 hdrlen += ddpSSize;
187 ddp_print(ndo, bp, length, GET_U_1(sdp->type), 0,
188 GET_U_1(lp->src), GET_U_1(sdp->srcSkt));
189 break;
190
191 case lapDDP:
192 ndo->ndo_protocol = "ddp";
193 ND_ICHECKMSG_U("DDP length", length, <, ddpSize);
194 dp = (const struct atDDP *)bp;
195 snet = GET_BE_U_2(dp->srcNet);
196 ND_PRINT("%s.%s",
197 ataddr_string(ndo, snet, GET_U_1(dp->srcNode)),
198 ddpskt_string(ndo, GET_U_1(dp->srcSkt)));
199 ND_PRINT(" > %s.%s:",
200 ataddr_string(ndo, GET_BE_U_2(dp->dstNet), GET_U_1(dp->dstNode)),
201 ddpskt_string(ndo, GET_U_1(dp->dstSkt)));
202 bp += ddpSize;
203 length -= ddpSize;
204 hdrlen += ddpSize;
205 ddp_print(ndo, bp, length, GET_U_1(dp->type), snet,
206 GET_U_1(dp->srcNode), GET_U_1(dp->srcSkt));
207 break;
208
209 default:
210 ND_PRINT("%u > %u at-lap#%u %u",
211 GET_U_1(lp->src), GET_U_1(lp->dst), GET_U_1(lp->type),
212 length);
213 break;
214 }
215 return (hdrlen);
216 invalid:
217 nd_print_invalid(ndo);
218 return length;
219 }
220
221 /*
222 * Print EtherTalk/TokenTalk packets (or FDDITalk, or whatever it's called
223 * when it runs over FDDI; yes, I've seen FDDI captures with AppleTalk
224 * packets in them).
225 */
226 void
227 atalk_print(netdissect_options *ndo,
228 const u_char *bp, u_int length)
229 {
230 const struct atDDP *dp;
231 u_short snet;
232
233 ndo->ndo_protocol = "atalk";
234 if(!ndo->ndo_eflag)
235 ND_PRINT("AT ");
236
237 ND_ICHECK_U(length, <, ddpSize);
238 dp = (const struct atDDP *)bp;
239 snet = GET_BE_U_2(dp->srcNet);
240 ND_PRINT("%s.%s", ataddr_string(ndo, snet, GET_U_1(dp->srcNode)),
241 ddpskt_string(ndo, GET_U_1(dp->srcSkt)));
242 ND_PRINT(" > %s.%s: ",
243 ataddr_string(ndo, GET_BE_U_2(dp->dstNet), GET_U_1(dp->dstNode)),
244 ddpskt_string(ndo, GET_U_1(dp->dstSkt)));
245 bp += ddpSize;
246 length -= ddpSize;
247 ddp_print(ndo, bp, length, GET_U_1(dp->type), snet,
248 GET_U_1(dp->srcNode), GET_U_1(dp->srcSkt));
249 return;
250 invalid:
251 nd_print_invalid(ndo);
252 }
253
254 /* XXX should probably pass in the snap header and do checks like arp_print() */
255 void
256 aarp_print(netdissect_options *ndo,
257 const u_char *bp, u_int length)
258 {
259 const struct aarp *ap;
260
261 #define AT(member) ataddr_string(ndo, \
262 (GET_U_1(&ap->member[1])<<8)|GET_U_1(&ap->member[2]), \
263 GET_U_1(&ap->member[3]))
264
265 ndo->ndo_protocol = "aarp";
266 ND_PRINT("aarp ");
267 ap = (const struct aarp *)bp;
268 ND_ICHECK_ZU(length, <, sizeof(*ap));
269 ND_TCHECK_SIZE(ap);
270 if (GET_BE_U_2(ap->htype) == 1 &&
271 GET_BE_U_2(ap->ptype) == ETHERTYPE_ATALK &&
272 GET_U_1(ap->halen) == MAC48_LEN && GET_U_1(ap->palen) == 4)
273 switch (GET_BE_U_2(ap->op)) {
274
275 case 1: /* request */
276 ND_PRINT("who-has %s tell %s", AT(pdaddr), AT(psaddr));
277 return;
278
279 case 2: /* response */
280 ND_PRINT("reply %s is-at %s", AT(psaddr), GET_MAC48_STRING(ap->hsaddr));
281 return;
282
283 case 3: /* probe (oy!) */
284 ND_PRINT("probe %s tell %s", AT(pdaddr), AT(psaddr));
285 return;
286 }
287 ND_PRINT("len %u op %u htype %u ptype %#x halen %u palen %u",
288 length, GET_BE_U_2(ap->op), GET_BE_U_2(ap->htype),
289 GET_BE_U_2(ap->ptype), GET_U_1(ap->halen), GET_U_1(ap->palen));
290 return;
291 invalid:
292 nd_print_invalid(ndo);
293 }
294
295 /*
296 * Print AppleTalk Datagram Delivery Protocol packets.
297 */
298 static void
299 ddp_print(netdissect_options *ndo,
300 const u_char *bp, u_int length, u_int t,
301 u_short snet, u_char snode, u_char skt)
302 {
303
304 switch (t) {
305
306 case ddpNBP:
307 nbp_print(ndo, (const struct atNBP *)bp, length, snet, snode, skt);
308 break;
309
310 case ddpATP:
311 atp_print(ndo, (const struct atATP *)bp, length);
312 break;
313
314 case ddpEIGRP:
315 eigrp_print(ndo, bp, length);
316 break;
317
318 default:
319 ND_PRINT(" at-%s %u", tok2str(type2str, NULL, t), length);
320 break;
321 }
322 }
323
324 static void
325 atp_print(netdissect_options *ndo,
326 const struct atATP *ap, u_int length)
327 {
328 uint8_t control;
329 uint32_t data;
330
331 ndo->ndo_protocol = "atp";
332 ND_ICHECKMSG_ZU("ATP length", length, <, sizeof(*ap));
333 length -= sizeof(*ap);
334 control = GET_U_1(ap->control);
335 switch (control & 0xc0) {
336
337 case atpReqCode:
338 ND_PRINT(" atp-req%s %u",
339 control & atpXO? " " : "*",
340 GET_BE_U_2(ap->transID));
341
342 atp_bitmap_print(ndo, GET_U_1(ap->bitmap));
343
344 if (length != 0)
345 ND_PRINT(" [len=%u]", length);
346
347 switch (control & (atpEOM|atpSTS)) {
348 case atpEOM:
349 ND_PRINT(" [EOM]");
350 break;
351 case atpSTS:
352 ND_PRINT(" [STS]");
353 break;
354 case atpEOM|atpSTS:
355 ND_PRINT(" [EOM,STS]");
356 break;
357 }
358 break;
359
360 case atpRspCode:
361 ND_PRINT(" atp-resp%s%u:%u (%u)",
362 control & atpEOM? "*" : " ",
363 GET_BE_U_2(ap->transID), GET_U_1(ap->bitmap),
364 length);
365 switch (control & (atpXO|atpSTS)) {
366 case atpXO:
367 ND_PRINT(" [XO]");
368 break;
369 case atpSTS:
370 ND_PRINT(" [STS]");
371 break;
372 case atpXO|atpSTS:
373 ND_PRINT(" [XO,STS]");
374 break;
375 }
376 break;
377
378 case atpRelCode:
379 ND_PRINT(" atp-rel %u", GET_BE_U_2(ap->transID));
380
381 atp_bitmap_print(ndo, GET_U_1(ap->bitmap));
382
383 /* length should be zero */
384 if (length)
385 ND_PRINT(" [len=%u]", length);
386
387 /* there shouldn't be any control flags */
388 if (control & (atpXO|atpEOM|atpSTS)) {
389 char c = '[';
390 if (control & atpXO) {
391 ND_PRINT("%cXO", c);
392 c = ',';
393 }
394 if (control & atpEOM) {
395 ND_PRINT("%cEOM", c);
396 c = ',';
397 }
398 if (control & atpSTS) {
399 ND_PRINT("%cSTS", c);
400 }
401 ND_PRINT("]");
402 }
403 break;
404
405 default:
406 ND_PRINT(" atp-0x%x %u (%u)", control,
407 GET_BE_U_2(ap->transID), length);
408 break;
409 }
410 data = GET_BE_U_4(ap->userData);
411 if (data != 0)
412 ND_PRINT(" 0x%x", data);
413 return;
414 invalid:
415 nd_print_invalid(ndo);
416 }
417
418 static void
419 atp_bitmap_print(netdissect_options *ndo,
420 u_char bm)
421 {
422 u_int i;
423
424 /*
425 * The '& 0xff' below is needed for compilers that want to sign
426 * extend a u_char, which is the case with the Ultrix compiler.
427 * (gcc is smart enough to eliminate it, at least on the Sparc).
428 *
429 * FIXME: If this problem no longer exists, this workaround should be
430 * removed. Otherwise the problem should be consistently detected and
431 * handled, perhaps at build time.
432 */
433 if ((bm + 1) & (bm & 0xff)) {
434 char c = '<';
435 for (i = 0; bm; ++i) {
436 if (bm & 1) {
437 ND_PRINT("%c%u", c, i);
438 c = ',';
439 }
440 bm >>= 1;
441 }
442 ND_PRINT(">");
443 } else {
444 for (i = 0; bm; ++i)
445 bm >>= 1;
446 if (i > 1)
447 ND_PRINT("<0-%u>", i - 1);
448 else
449 ND_PRINT("<0>");
450 }
451 }
452
453 static void
454 nbp_print(netdissect_options *ndo,
455 const struct atNBP *np, u_int length, u_short snet,
456 u_char snode, u_char skt)
457 {
458 const struct atNBPtuple *tp =
459 (const struct atNBPtuple *)((const u_char *)np + nbpHeaderSize);
460 uint8_t control;
461 u_int i;
462
463 /* must be room for at least one tuple */
464 ND_ICHECKMSG_U("undersized-nbp", length, <, nbpHeaderSize + 8);
465 length -= nbpHeaderSize;
466 control = GET_U_1(np->control);
467 ND_PRINT(" nbp-%s", tok2str(nbp_str, "0x%x", control & 0xf0));
468 ND_PRINT(" %u", GET_U_1(np->id));
469 switch (control & 0xf0) {
470
471 case nbpBrRq:
472 case nbpLkUp:
473 ND_PRINT(":");
474 (void)nbp_name_print(ndo, tp);
475 /*
476 * look for anomalies: the spec says there can only
477 * be one tuple, the address must match the source
478 * address and the enumerator should be zero.
479 */
480 if ((control & 0xf) != 1)
481 ND_PRINT(" [ntup=%u]", control & 0xf);
482 if (GET_U_1(tp->enumerator))
483 ND_PRINT(" [enum=%u]", GET_U_1(tp->enumerator));
484 if (GET_BE_U_2(tp->net) != snet ||
485 GET_U_1(tp->node) != snode ||
486 GET_U_1(tp->skt) != skt)
487 ND_PRINT(" [addr=%s.%u]",
488 ataddr_string(ndo, GET_BE_U_2(tp->net),
489 GET_U_1(tp->node)),
490 GET_U_1(tp->skt));
491 break;
492
493 case nbpLkUpReply:
494 ND_PRINT(":");
495
496 /* print each of the tuples in the reply */
497 for (i = control & 0xf; i != 0 && tp; i--)
498 tp = nbp_tuple_print(ndo, tp, snet, snode, skt);
499 break;
500
501 default:
502 ND_PRINT(" (%u)", length);
503 break;
504 }
505 return;
506 invalid:
507 nd_print_invalid(ndo);
508 }
509
510 /* print a counted string */
511 static const u_char *
512 print_cstring(netdissect_options *ndo,
513 const u_char *cp)
514 {
515 u_int length;
516
517 length = GET_U_1(cp);
518 cp++;
519
520 /* Spec says string can be at most 32 bytes long */
521 if (length > 32) {
522 ND_PRINT("[len=%u]", length);
523 ND_TCHECK_LEN(cp, length);
524 return NULL;
525 }
526 nd_printjn(ndo, cp, length);
527 return cp + length;
528 }
529
530 static const struct atNBPtuple *
531 nbp_tuple_print(netdissect_options *ndo,
532 const struct atNBPtuple *tp,
533 u_short snet, u_char snode, u_char skt)
534 {
535 const struct atNBPtuple *tpn;
536
537 tpn = nbp_name_print(ndo, tp);
538
539 /* if the enumerator isn't 1, print it */
540 if (GET_U_1(tp->enumerator) != 1)
541 ND_PRINT("(%u)", GET_U_1(tp->enumerator));
542
543 /* if the socket doesn't match the src socket, print it */
544 if (GET_U_1(tp->skt) != skt)
545 ND_PRINT(" %u", GET_U_1(tp->skt));
546
547 /* if the address doesn't match the src address, it's an anomaly */
548 if (GET_BE_U_2(tp->net) != snet ||
549 GET_U_1(tp->node) != snode)
550 ND_PRINT(" [addr=%s]",
551 ataddr_string(ndo, GET_BE_U_2(tp->net), GET_U_1(tp->node)));
552
553 return (tpn);
554 }
555
556 static const struct atNBPtuple *
557 nbp_name_print(netdissect_options *ndo,
558 const struct atNBPtuple *tp)
559 {
560 const u_char *cp = (const u_char *)tp + nbpTupleSize;
561
562 ND_PRINT(" ");
563
564 /* Object */
565 ND_PRINT("\"");
566 if ((cp = print_cstring(ndo, cp)) != NULL) {
567 /* Type */
568 ND_PRINT(":");
569 if ((cp = print_cstring(ndo, cp)) != NULL) {
570 /* Zone */
571 ND_PRINT("@");
572 if ((cp = print_cstring(ndo, cp)) != NULL)
573 ND_PRINT("\"");
574 }
575 }
576 return ((const struct atNBPtuple *)cp);
577 }
578
579
580 #define HASHNAMESIZE 4096
581
582 struct hnamemem {
583 u_int addr;
584 char *name;
585 struct hnamemem *nxt;
586 };
587
588 static struct hnamemem hnametable[HASHNAMESIZE];
589
590 static const char *
591 ataddr_string(netdissect_options *ndo,
592 u_short atnet, u_char athost)
593 {
594 struct hnamemem *tp, *tp2;
595 u_int i = (atnet << 8) | athost;
596 char nambuf[256+1];
597 static int first = 1;
598 FILE *fp;
599
600 /*
601 * Are we doing address to name resolution?
602 */
603 if (!ndo->ndo_nflag) {
604 /*
605 * Yes. Have we tried to open and read an AppleTalk
606 * number to name map file?
607 */
608 if (!first) {
609 /*
610 * No; try to do so.
611 */
612 first = 0;
613 fp = fopen("/etc/atalk.names", "r");
614 if (fp != NULL) {
615 char line[256];
616 u_int i1, i2;
617
618 while (fgets(line, sizeof(line), fp)) {
619 if (line[0] == '\n' || line[0] == 0 ||
620 line[0] == '#')
621 continue;
622 if (sscanf(line, "%u.%u %256s", &i1,
623 &i2, nambuf) == 3)
624 /* got a hostname. */
625 i2 |= (i1 << 8);
626 else if (sscanf(line, "%u %256s", &i1,
627 nambuf) == 2)
628 /* got a net name */
629 i2 = (i1 << 8) | 255;
630 else
631 continue;
632
633 for (tp = &hnametable[i2 & (HASHNAMESIZE-1)];
634 tp->nxt; tp = tp->nxt)
635 ;
636 tp->addr = i2;
637 tp->nxt = newhnamemem(ndo);
638 tp->name = strdup(nambuf);
639 if (tp->name == NULL)
640 (*ndo->ndo_error)(ndo,
641 S_ERR_ND_MEM_ALLOC,
642 "%s: strdup(nambuf)", __func__);
643 }
644 fclose(fp);
645 }
646 }
647 }
648
649 /*
650 * Now try to look up the address in the table.
651 */
652 for (tp = &hnametable[i & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt)
653 if (tp->addr == i)
654 return (tp->name);
655
656 /* didn't have the node name -- see if we've got the net name */
657 i |= 255;
658 for (tp2 = &hnametable[i & (HASHNAMESIZE-1)]; tp2->nxt; tp2 = tp2->nxt)
659 if (tp2->addr == i) {
660 tp->addr = (atnet << 8) | athost;
661 tp->nxt = newhnamemem(ndo);
662 (void)snprintf(nambuf, sizeof(nambuf), "%s.%u",
663 tp2->name, athost);
664 tp->name = strdup(nambuf);
665 if (tp->name == NULL)
666 (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
667 "%s: strdup(nambuf)", __func__);
668 return (tp->name);
669 }
670
671 tp->addr = (atnet << 8) | athost;
672 tp->nxt = newhnamemem(ndo);
673 if (athost != 255)
674 (void)snprintf(nambuf, sizeof(nambuf), "%u.%u", atnet, athost);
675 else
676 (void)snprintf(nambuf, sizeof(nambuf), "%u", atnet);
677 tp->name = strdup(nambuf);
678 if (tp->name == NULL)
679 (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
680 "%s: strdup(nambuf)", __func__);
681
682 return (tp->name);
683 }
684
685 #define rtmpSkt 1
686 #define nbpSkt 2
687 #define echoSkt 4
688 #define zipSkt 6
689 static const struct tok skt2str[] = {
690 { rtmpSkt, "rtmp" }, /* routing table maintenance */
691 { nbpSkt, "nis" }, /* name info socket */
692 { echoSkt, "echo" }, /* AppleTalk echo protocol */
693 { zipSkt, "zip" }, /* zone info protocol */
694 { 0, NULL }
695 };
696
697 static const char *
698 ddpskt_string(netdissect_options *ndo,
699 u_int skt)
700 {
701 static char buf[8];
702
703 if (ndo->ndo_nflag) {
704 (void)snprintf(buf, sizeof(buf), "%u", skt);
705 return (buf);
706 }
707 return (tok2str(skt2str, "%u", skt));
708 }