]>
The Tcpdump Group git mirrors - tcpdump/blob - print-decnet.c
2 * Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997
3 * The Regents of the University of California. All rights reserved.
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
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.
26 #include <tcpdump-stdinc.h>
31 #ifdef HAVE_NETDNET_DNETDB_H
32 #include <netdnet/dnetdb.h>
41 #include "interface.h"
42 #include "addrtoname.h"
44 static const char tstr
[] = "[|decnet]";
47 static int print_decnet_ctlmsg(const union routehdr
*, u_int
, u_int
);
48 static void print_t_info(int);
49 static int print_l1_routes(const char *, u_int
);
50 static int print_l2_routes(const char *, u_int
);
51 static void print_i_info(int);
52 static int print_elist(const char *, u_int
);
53 static int print_nsp(const u_char
*, u_int
);
54 static void print_reason(int);
56 static void pdata(u_char
*, int);
59 #ifndef HAVE_NETDNET_DNETDB_H_DNET_HTOA
60 extern char *dnet_htoa(struct dn_naddr
*);
64 decnet_print(register const u_char
*ap
, register u_int length
,
65 register u_int caplen
)
67 register const union routehdr
*rhp
;
73 if (length
< sizeof(struct shorthdr
)) {
74 (void)printf("%s", tstr
);
78 TCHECK2(*ap
, sizeof(short));
79 pktlen
= EXTRACT_LE_16BITS(ap
);
80 if (pktlen
< sizeof(struct shorthdr
)) {
81 (void)printf("%s", tstr
);
84 if (pktlen
> length
) {
85 (void)printf("%s", tstr
);
90 rhp
= (const union routehdr
*)&(ap
[sizeof(short)]);
91 TCHECK(rhp
->rh_short
.sh_flags
);
92 mflags
= EXTRACT_LE_8BITS(rhp
->rh_short
.sh_flags
);
94 if (mflags
& RMF_PAD
) {
95 /* pad bytes of some sort in front of message */
96 u_int padlen
= mflags
& RMF_PADMASK
;
98 (void) printf("[pad:%d] ", padlen
);
99 if (length
< padlen
+ 2) {
100 (void)printf("%s", tstr
);
103 TCHECK2(ap
[sizeof(short)], padlen
);
107 rhp
= (const union routehdr
*)&(ap
[sizeof(short)]);
108 mflags
= EXTRACT_LE_8BITS(rhp
->rh_short
.sh_flags
);
111 if (mflags
& RMF_FVER
) {
112 (void) printf("future-version-decnet");
113 default_print(ap
, min(length
, caplen
));
117 /* is it a control message? */
118 if (mflags
& RMF_CTLMSG
) {
119 if (!print_decnet_ctlmsg(rhp
, length
, caplen
))
124 switch (mflags
& RMF_MASK
) {
126 if (length
< sizeof(struct longhdr
)) {
127 (void)printf("%s", tstr
);
130 TCHECK(rhp
->rh_long
);
132 EXTRACT_LE_16BITS(rhp
->rh_long
.lg_dst
.dne_remote
.dne_nodeaddr
);
134 EXTRACT_LE_16BITS(rhp
->rh_long
.lg_src
.dne_remote
.dne_nodeaddr
);
135 hops
= EXTRACT_LE_8BITS(rhp
->rh_long
.lg_visits
);
136 nspp
= &(ap
[sizeof(short) + sizeof(struct longhdr
)]);
137 nsplen
= length
- sizeof(struct longhdr
);
140 TCHECK(rhp
->rh_short
);
141 dst
= EXTRACT_LE_16BITS(rhp
->rh_short
.sh_dst
);
142 src
= EXTRACT_LE_16BITS(rhp
->rh_short
.sh_src
);
143 hops
= (EXTRACT_LE_8BITS(rhp
->rh_short
.sh_visits
) & VIS_MASK
)+1;
144 nspp
= &(ap
[sizeof(short) + sizeof(struct shorthdr
)]);
145 nsplen
= length
- sizeof(struct shorthdr
);
148 (void) printf("unknown message flags under mask");
149 default_print((u_char
*)ap
, min(length
, caplen
));
153 (void)printf("%s > %s %d ",
154 dnaddr_string(src
), dnaddr_string(dst
), pktlen
);
156 if (mflags
& RMF_RQR
)
157 (void)printf("RQR ");
158 if (mflags
& RMF_RTS
)
159 (void)printf("RTS ");
162 (void)printf("%d hops ", hops
);
165 if (!print_nsp(nspp
, nsplen
))
170 (void)printf("%s", tstr
);
175 print_decnet_ctlmsg(register const union routehdr
*rhp
, u_int length
,
178 int mflags
= EXTRACT_LE_8BITS(rhp
->rh_short
.sh_flags
);
179 register union controlmsg
*cmp
= (union controlmsg
*)rhp
;
180 int src
, dst
, info
, blksize
, eco
, ueco
, hello
, other
, vers
;
181 etheraddr srcea
, rtea
;
183 char *rhpx
= (char *)rhp
;
186 switch (mflags
& RMF_CTLMASK
) {
188 (void)printf("init ");
189 if (length
< sizeof(struct initmsg
))
191 TCHECK(cmp
->cm_init
);
192 src
= EXTRACT_LE_16BITS(cmp
->cm_init
.in_src
);
193 info
= EXTRACT_LE_8BITS(cmp
->cm_init
.in_info
);
194 blksize
= EXTRACT_LE_16BITS(cmp
->cm_init
.in_blksize
);
195 vers
= EXTRACT_LE_8BITS(cmp
->cm_init
.in_vers
);
196 eco
= EXTRACT_LE_8BITS(cmp
->cm_init
.in_eco
);
197 ueco
= EXTRACT_LE_8BITS(cmp
->cm_init
.in_ueco
);
198 hello
= EXTRACT_LE_16BITS(cmp
->cm_init
.in_hello
);
201 "src %sblksize %d vers %d eco %d ueco %d hello %d",
202 dnaddr_string(src
), blksize
, vers
, eco
, ueco
,
207 (void)printf("verification ");
208 if (length
< sizeof(struct verifmsg
))
211 src
= EXTRACT_LE_16BITS(cmp
->cm_ver
.ve_src
);
212 other
= EXTRACT_LE_8BITS(cmp
->cm_ver
.ve_fcnval
);
213 (void)printf("src %s fcnval %o", dnaddr_string(src
), other
);
217 (void)printf("test ");
218 if (length
< sizeof(struct testmsg
))
220 TCHECK(cmp
->cm_test
);
221 src
= EXTRACT_LE_16BITS(cmp
->cm_test
.te_src
);
222 other
= EXTRACT_LE_8BITS(cmp
->cm_test
.te_data
);
223 (void)printf("src %s data %o", dnaddr_string(src
), other
);
227 (void)printf("lev-1-routing ");
228 if (length
< sizeof(struct l1rout
))
230 TCHECK(cmp
->cm_l1rou
);
231 src
= EXTRACT_LE_16BITS(cmp
->cm_l1rou
.r1_src
);
232 (void)printf("src %s ", dnaddr_string(src
));
233 ret
= print_l1_routes(&(rhpx
[sizeof(struct l1rout
)]),
234 length
- sizeof(struct l1rout
));
237 (void)printf("lev-2-routing ");
238 if (length
< sizeof(struct l2rout
))
240 TCHECK(cmp
->cm_l2rout
);
241 src
= EXTRACT_LE_16BITS(cmp
->cm_l2rout
.r2_src
);
242 (void)printf("src %s ", dnaddr_string(src
));
243 ret
= print_l2_routes(&(rhpx
[sizeof(struct l2rout
)]),
244 length
- sizeof(struct l2rout
));
247 (void)printf("router-hello ");
248 if (length
< sizeof(struct rhellomsg
))
250 TCHECK(cmp
->cm_rhello
);
251 vers
= EXTRACT_LE_8BITS(cmp
->cm_rhello
.rh_vers
);
252 eco
= EXTRACT_LE_8BITS(cmp
->cm_rhello
.rh_eco
);
253 ueco
= EXTRACT_LE_8BITS(cmp
->cm_rhello
.rh_ueco
);
254 memcpy((char *)&srcea
, (char *)&(cmp
->cm_rhello
.rh_src
),
256 src
= EXTRACT_LE_16BITS(srcea
.dne_remote
.dne_nodeaddr
);
257 info
= EXTRACT_LE_8BITS(cmp
->cm_rhello
.rh_info
);
258 blksize
= EXTRACT_LE_16BITS(cmp
->cm_rhello
.rh_blksize
);
259 priority
= EXTRACT_LE_8BITS(cmp
->cm_rhello
.rh_priority
);
260 hello
= EXTRACT_LE_16BITS(cmp
->cm_rhello
.rh_hello
);
263 "vers %d eco %d ueco %d src %s blksize %d pri %d hello %d",
264 vers
, eco
, ueco
, dnaddr_string(src
),
265 blksize
, priority
, hello
);
266 ret
= print_elist(&(rhpx
[sizeof(struct rhellomsg
)]),
267 length
- sizeof(struct rhellomsg
));
270 (void)printf("endnode-hello ");
271 if (length
< sizeof(struct ehellomsg
))
273 TCHECK(cmp
->cm_ehello
);
274 vers
= EXTRACT_LE_8BITS(cmp
->cm_ehello
.eh_vers
);
275 eco
= EXTRACT_LE_8BITS(cmp
->cm_ehello
.eh_eco
);
276 ueco
= EXTRACT_LE_8BITS(cmp
->cm_ehello
.eh_ueco
);
277 memcpy((char *)&srcea
, (char *)&(cmp
->cm_ehello
.eh_src
),
279 src
= EXTRACT_LE_16BITS(srcea
.dne_remote
.dne_nodeaddr
);
280 info
= EXTRACT_LE_8BITS(cmp
->cm_ehello
.eh_info
);
281 blksize
= EXTRACT_LE_16BITS(cmp
->cm_ehello
.eh_blksize
);
283 memcpy((char *)&rtea
, (char *)&(cmp
->cm_ehello
.eh_router
),
285 dst
= EXTRACT_LE_16BITS(rtea
.dne_remote
.dne_nodeaddr
);
286 hello
= EXTRACT_LE_16BITS(cmp
->cm_ehello
.eh_hello
);
287 other
= EXTRACT_LE_8BITS(cmp
->cm_ehello
.eh_data
);
290 "vers %d eco %d ueco %d src %s blksize %d rtr %s hello %d data %o",
291 vers
, eco
, ueco
, dnaddr_string(src
),
292 blksize
, dnaddr_string(dst
), hello
, other
);
297 (void)printf("unknown control message");
298 default_print((u_char
*)rhp
, min(length
, caplen
));
309 print_t_info(int info
)
311 int ntype
= info
& 3;
313 case 0: (void)printf("reserved-ntype? "); break;
314 case TI_L2ROUT
: (void)printf("l2rout "); break;
315 case TI_L1ROUT
: (void)printf("l1rout "); break;
316 case TI_ENDNODE
: (void)printf("endnode "); break;
319 (void)printf("verif ");
321 (void)printf("blo ");
325 print_l1_routes(const char *rp
, u_int len
)
331 /* The last short is a checksum */
332 while (len
> (3 * sizeof(short))) {
333 TCHECK2(*rp
, 3 * sizeof(short));
334 count
= EXTRACT_LE_16BITS(rp
);
336 return (1); /* seems to be bogus from here on */
338 len
-= sizeof(short);
339 id
= EXTRACT_LE_16BITS(rp
);
341 len
-= sizeof(short);
342 info
= EXTRACT_LE_16BITS(rp
);
344 len
-= sizeof(short);
345 (void)printf("{ids %d-%d cost %d hops %d} ", id
, id
+ count
,
346 RI_COST(info
), RI_HOPS(info
));
355 print_l2_routes(const char *rp
, u_int len
)
361 /* The last short is a checksum */
362 while (len
> (3 * sizeof(short))) {
363 TCHECK2(*rp
, 3 * sizeof(short));
364 count
= EXTRACT_LE_16BITS(rp
);
366 return (1); /* seems to be bogus from here on */
368 len
-= sizeof(short);
369 area
= EXTRACT_LE_16BITS(rp
);
371 len
-= sizeof(short);
372 info
= EXTRACT_LE_16BITS(rp
);
374 len
-= sizeof(short);
375 (void)printf("{areas %d-%d cost %d hops %d} ", area
, area
+ count
,
376 RI_COST(info
), RI_HOPS(info
));
385 print_i_info(int info
)
387 int ntype
= info
& II_TYPEMASK
;
389 case 0: (void)printf("reserved-ntype? "); break;
390 case II_L2ROUT
: (void)printf("l2rout "); break;
391 case II_L1ROUT
: (void)printf("l1rout "); break;
392 case II_ENDNODE
: (void)printf("endnode "); break;
395 (void)printf("verif ");
396 if (info
& II_NOMCAST
)
397 (void)printf("nomcast ");
399 (void)printf("blo ");
403 print_elist(const char *elp _U_
, u_int len _U_
)
405 /* Not enough examples available for me to debug this */
410 print_nsp(const u_char
*nspp
, u_int nsplen
)
412 const struct nsphdr
*nsphp
= (struct nsphdr
*)nspp
;
415 if (nsplen
< sizeof(struct nsphdr
))
418 flags
= EXTRACT_LE_8BITS(nsphp
->nh_flags
);
419 dst
= EXTRACT_LE_16BITS(nsphp
->nh_dst
);
420 src
= EXTRACT_LE_16BITS(nsphp
->nh_src
);
422 switch (flags
& NSP_TYPEMASK
) {
424 switch (flags
& NSP_SUBMASK
) {
428 case MFS_BOM
+MFS_EOM
:
429 printf("data %d>%d ", src
, dst
);
431 struct seghdr
*shp
= (struct seghdr
*)nspp
;
436 u_int data_off
= sizeof(struct minseghdr
);
438 if (nsplen
< data_off
)
440 TCHECK(shp
->sh_seq
[0]);
441 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[0]);
442 if (ack
& SGQ_ACK
) { /* acknum field */
443 if ((ack
& SGQ_NAK
) == SGQ_NAK
)
444 (void)printf("nak %d ", ack
& SGQ_MASK
);
446 (void)printf("ack %d ", ack
& SGQ_MASK
);
447 data_off
+= sizeof(short);
448 if (nsplen
< data_off
)
450 TCHECK(shp
->sh_seq
[1]);
451 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[1]);
452 if (ack
& SGQ_OACK
) { /* ackoth field */
453 if ((ack
& SGQ_ONAK
) == SGQ_ONAK
)
454 (void)printf("onak %d ", ack
& SGQ_MASK
);
456 (void)printf("oack %d ", ack
& SGQ_MASK
);
457 data_off
+= sizeof(short);
458 if (nsplen
< data_off
)
460 TCHECK(shp
->sh_seq
[2]);
461 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[2]);
464 (void)printf("seg %d ", ack
& SGQ_MASK
);
466 if (nsplen
> data_off
) {
467 dp
= &(nspp
[data_off
]);
468 TCHECK2(*dp
, nsplen
- data_off
);
469 pdata(dp
, nsplen
- data_off
);
474 case MFS_ILS
+MFS_INT
:
477 struct seghdr
*shp
= (struct seghdr
*)nspp
;
482 u_int data_off
= sizeof(struct minseghdr
);
484 if (nsplen
< data_off
)
486 TCHECK(shp
->sh_seq
[0]);
487 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[0]);
488 if (ack
& SGQ_ACK
) { /* acknum field */
489 if ((ack
& SGQ_NAK
) == SGQ_NAK
)
490 (void)printf("nak %d ", ack
& SGQ_MASK
);
492 (void)printf("ack %d ", ack
& SGQ_MASK
);
493 data_off
+= sizeof(short);
494 if (nsplen
< data_off
)
496 TCHECK(shp
->sh_seq
[1]);
497 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[1]);
498 if (ack
& SGQ_OACK
) { /* ackdat field */
499 if ((ack
& SGQ_ONAK
) == SGQ_ONAK
)
500 (void)printf("nakdat %d ", ack
& SGQ_MASK
);
502 (void)printf("ackdat %d ", ack
& SGQ_MASK
);
503 data_off
+= sizeof(short);
504 if (nsplen
< data_off
)
506 TCHECK(shp
->sh_seq
[2]);
507 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[2]);
510 (void)printf("seg %d ", ack
& SGQ_MASK
);
512 if (nsplen
> data_off
) {
513 dp
= &(nspp
[data_off
]);
514 TCHECK2(*dp
, nsplen
- data_off
);
515 pdata(dp
, nsplen
- data_off
);
521 (void)printf("link-service %d>%d ", src
, dst
);
523 struct seghdr
*shp
= (struct seghdr
*)nspp
;
525 (struct lsmsg
*)&(nspp
[sizeof(struct seghdr
)]);
529 if (nsplen
< sizeof(struct seghdr
) + sizeof(struct lsmsg
))
531 TCHECK(shp
->sh_seq
[0]);
532 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[0]);
533 if (ack
& SGQ_ACK
) { /* acknum field */
534 if ((ack
& SGQ_NAK
) == SGQ_NAK
)
535 (void)printf("nak %d ", ack
& SGQ_MASK
);
537 (void)printf("ack %d ", ack
& SGQ_MASK
);
538 TCHECK(shp
->sh_seq
[1]);
539 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[1]);
540 if (ack
& SGQ_OACK
) { /* ackdat field */
541 if ((ack
& SGQ_ONAK
) == SGQ_ONAK
)
542 (void)printf("nakdat %d ", ack
& SGQ_MASK
);
544 (void)printf("ackdat %d ", ack
& SGQ_MASK
);
545 TCHECK(shp
->sh_seq
[2]);
546 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[2]);
549 (void)printf("seg %d ", ack
& SGQ_MASK
);
551 lsflags
= EXTRACT_LE_8BITS(lsmp
->ls_lsflags
);
552 fcval
= EXTRACT_LE_8BITS(lsmp
->ls_fcval
);
553 switch (lsflags
& LSI_MASK
) {
555 (void)printf("dat seg count %d ", fcval
);
556 switch (lsflags
& LSM_MASK
) {
560 (void)printf("donotsend-data ");
563 (void)printf("send-data ");
566 (void)printf("reserved-fcmod? %x", lsflags
);
571 (void)printf("intr req count %d ", fcval
);
574 (void)printf("reserved-fcval-int? %x", lsflags
);
580 (void)printf("reserved-subtype? %x %d > %d", flags
, src
, dst
);
585 switch (flags
& NSP_SUBMASK
) {
587 (void)printf("data-ack %d>%d ", src
, dst
);
589 struct ackmsg
*amp
= (struct ackmsg
*)nspp
;
592 if (nsplen
< sizeof(struct ackmsg
))
595 ack
= EXTRACT_LE_16BITS(amp
->ak_acknum
[0]);
596 if (ack
& SGQ_ACK
) { /* acknum field */
597 if ((ack
& SGQ_NAK
) == SGQ_NAK
)
598 (void)printf("nak %d ", ack
& SGQ_MASK
);
600 (void)printf("ack %d ", ack
& SGQ_MASK
);
601 ack
= EXTRACT_LE_16BITS(amp
->ak_acknum
[1]);
602 if (ack
& SGQ_OACK
) { /* ackoth field */
603 if ((ack
& SGQ_ONAK
) == SGQ_ONAK
)
604 (void)printf("onak %d ", ack
& SGQ_MASK
);
606 (void)printf("oack %d ", ack
& SGQ_MASK
);
612 (void)printf("ils-ack %d>%d ", src
, dst
);
614 struct ackmsg
*amp
= (struct ackmsg
*)nspp
;
617 if (nsplen
< sizeof(struct ackmsg
))
620 ack
= EXTRACT_LE_16BITS(amp
->ak_acknum
[0]);
621 if (ack
& SGQ_ACK
) { /* acknum field */
622 if ((ack
& SGQ_NAK
) == SGQ_NAK
)
623 (void)printf("nak %d ", ack
& SGQ_MASK
);
625 (void)printf("ack %d ", ack
& SGQ_MASK
);
626 TCHECK(amp
->ak_acknum
[1]);
627 ack
= EXTRACT_LE_16BITS(amp
->ak_acknum
[1]);
628 if (ack
& SGQ_OACK
) { /* ackdat field */
629 if ((ack
& SGQ_ONAK
) == SGQ_ONAK
)
630 (void)printf("nakdat %d ", ack
& SGQ_MASK
);
632 (void)printf("ackdat %d ", ack
& SGQ_MASK
);
638 (void)printf("conn-ack %d", dst
);
641 (void)printf("reserved-acktype? %x %d > %d", flags
, src
, dst
);
646 switch (flags
& NSP_SUBMASK
) {
649 if ((flags
& NSP_SUBMASK
) == MFS_CI
)
650 (void)printf("conn-initiate ");
652 (void)printf("retrans-conn-initiate ");
653 (void)printf("%d>%d ", src
, dst
);
655 struct cimsg
*cimp
= (struct cimsg
*)nspp
;
656 int services
, info
, segsize
;
661 if (nsplen
< sizeof(struct cimsg
))
664 services
= EXTRACT_LE_8BITS(cimp
->ci_services
);
665 info
= EXTRACT_LE_8BITS(cimp
->ci_info
);
666 segsize
= EXTRACT_LE_16BITS(cimp
->ci_segsize
);
668 switch (services
& COS_MASK
) {
672 (void)printf("seg ");
675 (void)printf("msg ");
678 (void)printf("crypt ");
681 switch (info
& COI_MASK
) {
683 (void)printf("ver 3.2 ");
686 (void)printf("ver 3.1 ");
689 (void)printf("ver 4.0 ");
692 (void)printf("ver 4.1 ");
695 (void)printf("segsize %d ", segsize
);
697 if (nsplen
> sizeof(struct cimsg
)) {
698 dp
= &(nspp
[sizeof(struct cimsg
)]);
699 TCHECK2(*dp
, nsplen
- sizeof(struct cimsg
));
700 pdata(dp
, nsplen
- sizeof(struct cimsg
));
706 (void)printf("conn-confirm %d>%d ", src
, dst
);
708 struct ccmsg
*ccmp
= (struct ccmsg
*)nspp
;
710 u_int segsize
, optlen
;
715 if (nsplen
< sizeof(struct ccmsg
))
718 services
= EXTRACT_LE_8BITS(ccmp
->cc_services
);
719 info
= EXTRACT_LE_8BITS(ccmp
->cc_info
);
720 segsize
= EXTRACT_LE_16BITS(ccmp
->cc_segsize
);
721 optlen
= EXTRACT_LE_8BITS(ccmp
->cc_optlen
);
723 switch (services
& COS_MASK
) {
727 (void)printf("seg ");
730 (void)printf("msg ");
733 (void)printf("crypt ");
736 switch (info
& COI_MASK
) {
738 (void)printf("ver 3.2 ");
741 (void)printf("ver 3.1 ");
744 (void)printf("ver 4.0 ");
747 (void)printf("ver 4.1 ");
750 (void)printf("segsize %d ", segsize
);
752 (void)printf("optlen %d ", optlen
);
754 if (optlen
> nsplen
- sizeof(struct ccmsg
))
756 dp
= &(nspp
[sizeof(struct ccmsg
)]);
757 TCHECK2(*dp
, optlen
);
764 (void)printf("disconn-initiate %d>%d ", src
, dst
);
766 struct dimsg
*dimp
= (struct dimsg
*)nspp
;
773 if (nsplen
< sizeof(struct dimsg
))
776 reason
= EXTRACT_LE_16BITS(dimp
->di_reason
);
777 optlen
= EXTRACT_LE_8BITS(dimp
->di_optlen
);
779 print_reason(reason
);
781 (void)printf("optlen %d ", optlen
);
783 if (optlen
> nsplen
- sizeof(struct dimsg
))
785 dp
= &(nspp
[sizeof(struct dimsg
)]);
786 TCHECK2(*dp
, optlen
);
793 (void)printf("disconn-confirm %d>%d ", src
, dst
);
795 struct dcmsg
*dcmp
= (struct dcmsg
*)nspp
;
799 reason
= EXTRACT_LE_16BITS(dcmp
->dc_reason
);
801 print_reason(reason
);
805 (void)printf("reserved-ctltype? %x %d > %d", flags
, src
, dst
);
810 (void)printf("reserved-type? %x %d > %d", flags
, src
, dst
);
819 static const struct tok reason2str
[] = {
820 { UC_OBJREJECT
, "object rejected connect" },
821 { UC_RESOURCES
, "insufficient resources" },
822 { UC_NOSUCHNODE
, "unrecognized node name" },
823 { DI_SHUT
, "node is shutting down" },
824 { UC_NOSUCHOBJ
, "unrecognized object" },
825 { UC_INVOBJFORMAT
, "invalid object name format" },
826 { UC_OBJTOOBUSY
, "object too busy" },
827 { DI_PROTOCOL
, "protocol error discovered" },
828 { DI_TPA
, "third party abort" },
829 { UC_USERABORT
, "user abort" },
830 { UC_INVNODEFORMAT
, "invalid node name format" },
831 { UC_LOCALSHUT
, "local node shutting down" },
832 { DI_LOCALRESRC
, "insufficient local resources" },
833 { DI_REMUSERRESRC
, "insufficient remote user resources" },
834 { UC_ACCESSREJECT
, "invalid access control information" },
835 { DI_BADACCNT
, "bad ACCOUNT information" },
836 { UC_NORESPONSE
, "no response from object" },
837 { UC_UNREACHABLE
, "node unreachable" },
838 { DC_NOLINK
, "no link terminate" },
839 { DC_COMPLETE
, "disconnect complete" },
840 { DI_BADIMAGE
, "bad image data in connect" },
841 { DI_SERVMISMATCH
, "cryptographic service mismatch" },
846 print_reason(register int reason
)
848 printf("%s ", tok2str(reason2str
, "reason-%d", reason
));
852 dnnum_string(u_short dnaddr
)
856 int area
= (u_short
)(dnaddr
& AREAMASK
) >> AREASHIFT
;
857 int node
= dnaddr
& NODEMASK
;
859 str
= (char *)malloc(siz
= sizeof("00.0000"));
861 error("dnnum_string: malloc");
862 snprintf(str
, siz
, "%d.%d", area
, node
);
867 dnname_string(u_short dnaddr
)
869 #ifdef HAVE_DNET_HTOA
872 dna
.a_len
= sizeof(short);
873 memcpy((char *)dna
.a_addr
, (char *)&dnaddr
, sizeof(short));
874 return (strdup(dnet_htoa(&dna
)));
876 return(dnnum_string(dnaddr
)); /* punt */
882 pdata(u_char
*dp
, u_int maxlen
)