]>
git.saurik.com Git - apple/network_cmds.git/blob - tcpdump.tproj/print-decnet.c
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.0 (the 'License'). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
22 * @APPLE_LICENSE_HEADER_END@
25 * Copyright (c) 1992, 1993, 1994, 1995, 1996
26 * The Regents of the University of California. All rights reserved.
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that: (1) source code distributions
30 * retain the above copyright notice and this paragraph in its entirety, (2)
31 * distributions including binary code include the above copyright notice and
32 * this paragraph in its entirety in the documentation or other materials
33 * provided with the distribution, and (3) all advertising materials mentioning
34 * features or use of this software display the following acknowledgement:
35 * ``This product includes software developed by the University of California,
36 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
37 * the University nor the names of its contributors may be used to endorse
38 * or promote products derived from this software without specific prior
40 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
41 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
42 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
46 static const char rcsid
[] =
47 "@(#) $Header: /cvs/Darwin/Commands/NeXT/network_cmds/tcpdump.tproj/print-decnet.c,v 1.1.1.1 1999/05/02 03:58:33 wsanchez Exp $ (LBL)";
50 #include <sys/param.h>
52 #include <sys/socket.h>
61 #include <netdnet/dnetdb.h>
72 #include "interface.h"
73 #include "addrtoname.h"
76 static void print_decnet_ctlmsg(const union routehdr
*, u_int
);
77 static void print_t_info(int);
78 static void print_l1_routes(const char *, u_int
);
79 static void print_l2_routes(const char *, u_int
);
80 static void print_i_info(int);
81 static void print_elist(const char *, u_int
);
82 static void print_nsp(const u_char
*, u_int
);
83 static void print_reason(int);
85 static void pdata(u_char
*, int);
89 extern char *dnet_htoa(struct dn_naddr
*);
93 decnet_print(register const u_char
*ap
, register u_int length
,
94 register u_int caplen
)
96 static union routehdr rhcopy
;
97 register union routehdr
*rhp
= &rhcopy
;
100 u_int rhlen
, nsplen
, pktlen
;
103 if (length
< sizeof(struct shorthdr
)) {
104 (void)printf("[|decnet]");
108 pktlen
= EXTRACT_LE_16BITS(ap
);
110 rhlen
= min(length
, caplen
);
111 rhlen
= min(rhlen
, sizeof(*rhp
));
112 memcpy((char *)rhp
, (char *)&(ap
[sizeof(short)]), rhlen
);
114 mflags
= EXTRACT_LE_8BITS(rhp
->rh_short
.sh_flags
);
116 if (mflags
& RMF_PAD
) {
117 /* pad bytes of some sort in front of message */
118 u_int padlen
= mflags
& RMF_PADMASK
;
120 (void) printf("[pad:%d] ", padlen
);
124 rhlen
= min(length
, caplen
);
125 rhlen
= min(rhlen
, sizeof(*rhp
));
126 memcpy((char *)rhp
, (char *)&(ap
[sizeof(short)]), rhlen
);
127 mflags
= EXTRACT_LE_8BITS(rhp
->rh_short
.sh_flags
);
130 if (mflags
& RMF_FVER
) {
131 (void) printf("future-version-decnet");
132 default_print(ap
, length
);
136 /* is it a control message? */
137 if (mflags
& RMF_CTLMSG
) {
138 print_decnet_ctlmsg(rhp
, min(length
, caplen
));
142 switch (mflags
& RMF_MASK
) {
145 EXTRACT_LE_16BITS(rhp
->rh_long
.lg_dst
.dne_remote
.dne_nodeaddr
);
147 EXTRACT_LE_16BITS(rhp
->rh_long
.lg_src
.dne_remote
.dne_nodeaddr
);
148 hops
= EXTRACT_LE_8BITS(rhp
->rh_long
.lg_visits
);
149 nspp
= &(ap
[sizeof(short) + sizeof(struct longhdr
)]);
150 nsplen
= min((length
- sizeof(struct longhdr
)),
151 (caplen
- sizeof(struct longhdr
)));
154 dst
= EXTRACT_LE_16BITS(rhp
->rh_short
.sh_dst
);
155 src
= EXTRACT_LE_16BITS(rhp
->rh_short
.sh_src
);
156 hops
= (EXTRACT_LE_8BITS(rhp
->rh_short
.sh_visits
) & VIS_MASK
)+1;
157 nspp
= &(ap
[sizeof(short) + sizeof(struct shorthdr
)]);
158 nsplen
= min((length
- sizeof(struct shorthdr
)),
159 (caplen
- sizeof(struct shorthdr
)));
162 (void) printf("unknown message flags under mask");
163 default_print((u_char
*)ap
, length
);
167 (void)printf("%s > %s %d ",
168 dnaddr_string(src
), dnaddr_string(dst
), pktlen
);
170 if (mflags
& RMF_RQR
)
171 (void)printf("RQR ");
172 if (mflags
& RMF_RTS
)
173 (void)printf("RTS ");
176 (void)printf("%d hops ", hops
);
179 print_nsp(nspp
, nsplen
);
183 print_decnet_ctlmsg(register const union routehdr
*rhp
, u_int length
)
185 int mflags
= EXTRACT_LE_8BITS(rhp
->rh_short
.sh_flags
);
186 register union controlmsg
*cmp
= (union controlmsg
*)rhp
;
187 int src
, dst
, info
, blksize
, eco
, ueco
, hello
, other
, vers
;
188 etheraddr srcea
, rtea
;
190 char *rhpx
= (char *)rhp
;
192 switch (mflags
& RMF_CTLMASK
) {
194 (void)printf("init ");
195 src
= EXTRACT_LE_16BITS(cmp
->cm_init
.in_src
);
196 info
= EXTRACT_LE_8BITS(cmp
->cm_init
.in_info
);
197 blksize
= EXTRACT_LE_16BITS(cmp
->cm_init
.in_blksize
);
198 vers
= EXTRACT_LE_8BITS(cmp
->cm_init
.in_vers
);
199 eco
= EXTRACT_LE_8BITS(cmp
->cm_init
.in_eco
);
200 ueco
= EXTRACT_LE_8BITS(cmp
->cm_init
.in_ueco
);
201 hello
= EXTRACT_LE_16BITS(cmp
->cm_init
.in_hello
);
204 "src %sblksize %d vers %d eco %d ueco %d hello %d",
205 dnaddr_string(src
), blksize
, vers
, eco
, ueco
,
209 (void)printf("verification ");
210 src
= EXTRACT_LE_16BITS(cmp
->cm_ver
.ve_src
);
211 other
= EXTRACT_LE_8BITS(cmp
->cm_ver
.ve_fcnval
);
212 (void)printf("src %s fcnval %o", dnaddr_string(src
), other
);
215 (void)printf("test ");
216 src
= EXTRACT_LE_16BITS(cmp
->cm_test
.te_src
);
217 other
= EXTRACT_LE_8BITS(cmp
->cm_test
.te_data
);
218 (void)printf("src %s data %o", dnaddr_string(src
), other
);
221 (void)printf("lev-1-routing ");
222 src
= EXTRACT_LE_16BITS(cmp
->cm_l1rou
.r1_src
);
223 (void)printf("src %s ", dnaddr_string(src
));
224 print_l1_routes(&(rhpx
[sizeof(struct l1rout
)]),
225 length
- sizeof(struct l1rout
));
228 (void)printf("lev-2-routing ");
229 src
= EXTRACT_LE_16BITS(cmp
->cm_l2rout
.r2_src
);
230 (void)printf("src %s ", dnaddr_string(src
));
231 print_l2_routes(&(rhpx
[sizeof(struct l2rout
)]),
232 length
- sizeof(struct l2rout
));
235 (void)printf("router-hello ");
236 vers
= EXTRACT_LE_8BITS(cmp
->cm_rhello
.rh_vers
);
237 eco
= EXTRACT_LE_8BITS(cmp
->cm_rhello
.rh_eco
);
238 ueco
= EXTRACT_LE_8BITS(cmp
->cm_rhello
.rh_ueco
);
239 memcpy((char *)&srcea
, (char *)&(cmp
->cm_rhello
.rh_src
),
241 src
= EXTRACT_LE_16BITS(srcea
.dne_remote
.dne_nodeaddr
);
242 info
= EXTRACT_LE_8BITS(cmp
->cm_rhello
.rh_info
);
243 blksize
= EXTRACT_LE_16BITS(cmp
->cm_rhello
.rh_blksize
);
244 priority
= EXTRACT_LE_8BITS(cmp
->cm_rhello
.rh_priority
);
245 hello
= EXTRACT_LE_16BITS(cmp
->cm_rhello
.rh_hello
);
248 "vers %d eco %d ueco %d src %s blksize %d pri %d hello %d",
249 vers
, eco
, ueco
, dnaddr_string(src
),
250 blksize
, priority
, hello
);
251 print_elist(&(rhpx
[sizeof(struct rhellomsg
)]),
252 length
- sizeof(struct rhellomsg
));
255 (void)printf("endnode-hello ");
256 vers
= EXTRACT_LE_8BITS(cmp
->cm_ehello
.eh_vers
);
257 eco
= EXTRACT_LE_8BITS(cmp
->cm_ehello
.eh_eco
);
258 ueco
= EXTRACT_LE_8BITS(cmp
->cm_ehello
.eh_ueco
);
259 memcpy((char *)&srcea
, (char *)&(cmp
->cm_ehello
.eh_src
),
261 src
= EXTRACT_LE_16BITS(srcea
.dne_remote
.dne_nodeaddr
);
262 info
= EXTRACT_LE_8BITS(cmp
->cm_ehello
.eh_info
);
263 blksize
= EXTRACT_LE_16BITS(cmp
->cm_ehello
.eh_blksize
);
265 memcpy((char *)&rtea
, (char *)&(cmp
->cm_ehello
.eh_router
),
267 dst
= EXTRACT_LE_16BITS(rtea
.dne_remote
.dne_nodeaddr
);
268 hello
= EXTRACT_LE_16BITS(cmp
->cm_ehello
.eh_hello
);
269 other
= EXTRACT_LE_8BITS(cmp
->cm_ehello
.eh_data
);
272 "vers %d eco %d ueco %d src %s blksize %d rtr %s hello %d data %o",
273 vers
, eco
, ueco
, dnaddr_string(src
),
274 blksize
, dnaddr_string(dst
), hello
, other
);
278 (void)printf("unknown control message");
279 default_print((u_char
*)rhp
, length
);
285 print_t_info(int info
)
287 int ntype
= info
& 3;
289 case 0: (void)printf("reserved-ntype? "); break;
290 case TI_L2ROUT
: (void)printf("l2rout "); break;
291 case TI_L1ROUT
: (void)printf("l1rout "); break;
292 case TI_ENDNODE
: (void)printf("endnode "); break;
295 (void)printf("verif ");
297 (void)printf("blo ");
301 print_l1_routes(const char *rp
, u_int len
)
307 /* The last short is a checksum */
308 while (len
> (3 * sizeof(short))) {
309 count
= EXTRACT_LE_16BITS(rp
);
311 return; /* seems to be bogus from here on */
313 len
-= sizeof(short);
314 id
= EXTRACT_LE_16BITS(rp
);
316 len
-= sizeof(short);
317 info
= EXTRACT_LE_16BITS(rp
);
319 len
-= sizeof(short);
320 (void)printf("{ids %d-%d cost %d hops %d} ", id
, id
+ count
,
321 RI_COST(info
), RI_HOPS(info
));
326 print_l2_routes(const char *rp
, u_int len
)
332 /* The last short is a checksum */
333 while (len
> (3 * sizeof(short))) {
334 count
= EXTRACT_LE_16BITS(rp
);
336 return; /* seems to be bogus from here on */
338 len
-= sizeof(short);
339 area
= EXTRACT_LE_16BITS(rp
);
341 len
-= sizeof(short);
342 info
= EXTRACT_LE_16BITS(rp
);
344 len
-= sizeof(short);
345 (void)printf("{areas %d-%d cost %d hops %d} ", area
, area
+ count
,
346 RI_COST(info
), RI_HOPS(info
));
351 print_i_info(int info
)
353 int ntype
= info
& II_TYPEMASK
;
355 case 0: (void)printf("reserved-ntype? "); break;
356 case II_L2ROUT
: (void)printf("l2rout "); break;
357 case II_L1ROUT
: (void)printf("l1rout "); break;
358 case II_ENDNODE
: (void)printf("endnode "); break;
361 (void)printf("verif ");
362 if (info
& II_NOMCAST
)
363 (void)printf("nomcast ");
365 (void)printf("blo ");
369 print_elist(const char *elp
, u_int len
)
371 /* Not enough examples available for me to debug this */
375 print_nsp(const u_char
*nspp
, u_int nsplen
)
377 const struct nsphdr
*nsphp
= (struct nsphdr
*)nspp
;
380 flags
= EXTRACT_LE_8BITS(nsphp
->nh_flags
);
381 dst
= EXTRACT_LE_16BITS(nsphp
->nh_dst
);
382 src
= EXTRACT_LE_16BITS(nsphp
->nh_src
);
384 switch (flags
& NSP_TYPEMASK
) {
386 switch (flags
& NSP_SUBMASK
) {
390 case MFS_BOM
+MFS_EOM
:
391 printf("data %d>%d ", src
, dst
);
393 struct seghdr
*shp
= (struct seghdr
*)nspp
;
398 u_int data_off
= sizeof(struct minseghdr
);
400 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[0]);
401 if (ack
& SGQ_ACK
) { /* acknum field */
402 if ((ack
& SGQ_NAK
) == SGQ_NAK
)
403 (void)printf("nak %d ", ack
& SGQ_MASK
);
405 (void)printf("ack %d ", ack
& SGQ_MASK
);
406 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[1]);
407 data_off
+= sizeof(short);
408 if (ack
& SGQ_OACK
) { /* ackoth field */
409 if ((ack
& SGQ_ONAK
) == SGQ_ONAK
)
410 (void)printf("onak %d ", ack
& SGQ_MASK
);
412 (void)printf("oack %d ", ack
& SGQ_MASK
);
413 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[2]);
414 data_off
+= sizeof(short);
417 (void)printf("seg %d ", ack
& SGQ_MASK
);
419 dp
= &(nspp
[data_off
]);
424 case MFS_ILS
+MFS_INT
:
427 struct seghdr
*shp
= (struct seghdr
*)nspp
;
432 u_int data_off
= sizeof(struct minseghdr
);
434 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[0]);
435 if (ack
& SGQ_ACK
) { /* acknum field */
436 if ((ack
& SGQ_NAK
) == SGQ_NAK
)
437 (void)printf("nak %d ", ack
& SGQ_MASK
);
439 (void)printf("ack %d ", ack
& SGQ_MASK
);
440 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[1]);
441 data_off
+= sizeof(short);
442 if (ack
& SGQ_OACK
) { /* ackdat field */
443 if ((ack
& SGQ_ONAK
) == SGQ_ONAK
)
444 (void)printf("nakdat %d ", ack
& SGQ_MASK
);
446 (void)printf("ackdat %d ", ack
& SGQ_MASK
);
447 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[2]);
448 data_off
+= sizeof(short);
451 (void)printf("seg %d ", ack
& SGQ_MASK
);
453 dp
= &(nspp
[data_off
]);
459 (void)printf("link-service %d>%d ", src
, dst
);
461 struct seghdr
*shp
= (struct seghdr
*)nspp
;
463 (struct lsmsg
*)&(nspp
[sizeof(struct seghdr
)]);
467 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[0]);
468 if (ack
& SGQ_ACK
) { /* acknum field */
469 if ((ack
& SGQ_NAK
) == SGQ_NAK
)
470 (void)printf("nak %d ", ack
& SGQ_MASK
);
472 (void)printf("ack %d ", ack
& SGQ_MASK
);
473 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[1]);
474 if (ack
& SGQ_OACK
) { /* ackdat field */
475 if ((ack
& SGQ_ONAK
) == SGQ_ONAK
)
476 (void)printf("nakdat %d ", ack
& SGQ_MASK
);
478 (void)printf("ackdat %d ", ack
& SGQ_MASK
);
479 ack
= EXTRACT_LE_16BITS(shp
->sh_seq
[2]);
482 (void)printf("seg %d ", ack
& SGQ_MASK
);
483 lsflags
= EXTRACT_LE_8BITS(lsmp
->ls_lsflags
);
484 fcval
= EXTRACT_LE_8BITS(lsmp
->ls_fcval
);
485 switch (lsflags
& LSI_MASK
) {
487 (void)printf("dat seg count %d ", fcval
);
488 switch (lsflags
& LSM_MASK
) {
492 (void)printf("donotsend-data ");
495 (void)printf("send-data ");
498 (void)printf("reserved-fcmod? %x", lsflags
);
503 (void)printf("intr req count %d ", fcval
);
506 (void)printf("reserved-fcval-int? %x", lsflags
);
512 (void)printf("reserved-subtype? %x %d > %d", flags
, src
, dst
);
517 switch (flags
& NSP_SUBMASK
) {
519 (void)printf("data-ack %d>%d ", src
, dst
);
521 struct ackmsg
*amp
= (struct ackmsg
*)nspp
;
524 ack
= EXTRACT_LE_16BITS(amp
->ak_acknum
[0]);
525 if (ack
& SGQ_ACK
) { /* acknum field */
526 if ((ack
& SGQ_NAK
) == SGQ_NAK
)
527 (void)printf("nak %d ", ack
& SGQ_MASK
);
529 (void)printf("ack %d ", ack
& SGQ_MASK
);
530 ack
= EXTRACT_LE_16BITS(amp
->ak_acknum
[1]);
531 if (ack
& SGQ_OACK
) { /* ackoth field */
532 if ((ack
& SGQ_ONAK
) == SGQ_ONAK
)
533 (void)printf("onak %d ", ack
& SGQ_MASK
);
535 (void)printf("oack %d ", ack
& SGQ_MASK
);
541 (void)printf("ils-ack %d>%d ", src
, dst
);
543 struct ackmsg
*amp
= (struct ackmsg
*)nspp
;
546 ack
= EXTRACT_LE_16BITS(amp
->ak_acknum
[0]);
547 if (ack
& SGQ_ACK
) { /* acknum field */
548 if ((ack
& SGQ_NAK
) == SGQ_NAK
)
549 (void)printf("nak %d ", ack
& SGQ_MASK
);
551 (void)printf("ack %d ", ack
& SGQ_MASK
);
552 ack
= EXTRACT_LE_16BITS(amp
->ak_acknum
[1]);
553 if (ack
& SGQ_OACK
) { /* ackdat field */
554 if ((ack
& SGQ_ONAK
) == SGQ_ONAK
)
555 (void)printf("nakdat %d ", ack
& SGQ_MASK
);
557 (void)printf("ackdat %d ", ack
& SGQ_MASK
);
563 (void)printf("conn-ack %d", dst
);
566 (void)printf("reserved-acktype? %x %d > %d", flags
, src
, dst
);
571 switch (flags
& NSP_SUBMASK
) {
574 if ((flags
& NSP_SUBMASK
) == MFS_CI
)
575 (void)printf("conn-initiate ");
577 (void)printf("retrans-conn-initiate ");
578 (void)printf("%d>%d ", src
, dst
);
580 struct cimsg
*cimp
= (struct cimsg
*)nspp
;
581 int services
, info
, segsize
;
586 services
= EXTRACT_LE_8BITS(cimp
->ci_services
);
587 info
= EXTRACT_LE_8BITS(cimp
->ci_info
);
588 segsize
= EXTRACT_LE_16BITS(cimp
->ci_segsize
);
590 switch (services
& COS_MASK
) {
594 (void)printf("seg ");
597 (void)printf("msg ");
600 (void)printf("crypt ");
603 switch (info
& COI_MASK
) {
605 (void)printf("ver 3.2 ");
608 (void)printf("ver 3.1 ");
611 (void)printf("ver 4.0 ");
614 (void)printf("ver 4.1 ");
617 (void)printf("segsize %d ", segsize
);
619 dp
= &(nspp
[sizeof(struct cimsg
)]);
620 pdata(dp
, nsplen
- sizeof(struct cimsg
));
625 (void)printf("conn-confirm %d>%d ", src
, dst
);
627 struct ccmsg
*ccmp
= (struct ccmsg
*)nspp
;
629 u_int segsize
, optlen
;
634 services
= EXTRACT_LE_8BITS(ccmp
->cc_services
);
635 info
= EXTRACT_LE_8BITS(ccmp
->cc_info
);
636 segsize
= EXTRACT_LE_16BITS(ccmp
->cc_segsize
);
637 optlen
= EXTRACT_LE_8BITS(ccmp
->cc_optlen
);
639 switch (services
& COS_MASK
) {
643 (void)printf("seg ");
646 (void)printf("msg ");
649 (void)printf("crypt ");
652 switch (info
& COI_MASK
) {
654 (void)printf("ver 3.2 ");
657 (void)printf("ver 3.1 ");
660 (void)printf("ver 4.0 ");
663 (void)printf("ver 4.1 ");
666 (void)printf("segsize %d ", segsize
);
668 (void)printf("optlen %d ", optlen
);
670 optlen
= min(optlen
, nsplen
- sizeof(struct ccmsg
));
671 dp
= &(nspp
[sizeof(struct ccmsg
)]);
678 (void)printf("disconn-initiate %d>%d ", src
, dst
);
680 struct dimsg
*dimp
= (struct dimsg
*)nspp
;
687 reason
= EXTRACT_LE_16BITS(dimp
->di_reason
);
688 optlen
= EXTRACT_LE_8BITS(dimp
->di_optlen
);
690 print_reason(reason
);
692 (void)printf("optlen %d ", optlen
);
694 optlen
= min(optlen
, nsplen
- sizeof(struct dimsg
));
695 dp
= &(nspp
[sizeof(struct dimsg
)]);
702 (void)printf("disconn-confirm %d>%d ", src
, dst
);
704 struct dcmsg
*dcmp
= (struct dcmsg
*)nspp
;
707 reason
= EXTRACT_LE_16BITS(dcmp
->dc_reason
);
709 print_reason(reason
);
713 (void)printf("reserved-ctltype? %x %d > %d", flags
, src
, dst
);
718 (void)printf("reserved-type? %x %d > %d", flags
, src
, dst
);
723 static struct tok reason2str
[] = {
724 { UC_OBJREJECT
, "object rejected connect" },
725 { UC_RESOURCES
, "insufficient resources" },
726 { UC_NOSUCHNODE
, "unrecognized node name" },
727 { DI_SHUT
, "node is shutting down" },
728 { UC_NOSUCHOBJ
, "unrecognized object" },
729 { UC_INVOBJFORMAT
, "invalid object name format" },
730 { UC_OBJTOOBUSY
, "object too busy" },
731 { DI_PROTOCOL
, "protocol error discovered" },
732 { DI_TPA
, "third party abort" },
733 { UC_USERABORT
, "user abort" },
734 { UC_INVNODEFORMAT
, "invalid node name format" },
735 { UC_LOCALSHUT
, "local node shutting down" },
736 { DI_LOCALRESRC
, "insufficient local resources" },
737 { DI_REMUSERRESRC
, "insufficient remote user resources" },
738 { UC_ACCESSREJECT
, "invalid access control information" },
739 { DI_BADACCNT
, "bad ACCOUNT information" },
740 { UC_NORESPONSE
, "no response from object" },
741 { UC_UNREACHABLE
, "node unreachable" },
742 { DC_NOLINK
, "no link terminate" },
743 { DC_COMPLETE
, "disconnect complete" },
744 { DI_BADIMAGE
, "bad image data in connect" },
745 { DI_SERVMISMATCH
, "cryptographic service mismatch" },
750 print_reason(register int reason
)
752 printf("%s ", tok2str(reason2str
, "reason-%d", reason
));
756 dnnum_string(u_short dnaddr
)
759 int area
= (u_short
)(dnaddr
& AREAMASK
) >> AREASHIFT
;
760 int node
= dnaddr
& NODEMASK
;
762 str
= (char *)malloc(sizeof("00.0000"));
764 error("dnnum_string: malloc");
765 sprintf(str
, "%d.%d", area
, node
);
770 dnname_string(u_short dnaddr
)
775 dna
.a_len
= sizeof(short);
776 memcpy((char *)dna
.a_addr
, (char *)&dnaddr
, sizeof(short));
777 return (savestr(dnet_htoa(&dna
)));
779 return(dnnum_string(dnaddr
)); /* punt */
785 pdata(u_char
*dp
, u_int maxlen
)
795 printf("\\%o", c
& 0xFF);