* Copyright (c) 1991 The Regents of the University of California.
* %sccs.include.redist.c%
* @(#)clnp_debug.c 7.9 (Berkeley) %G%
/***********************************************************
Copyright IBM Corporation 1987
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of IBM not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
******************************************************************/
* ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
/* $Header: clnp_debug.c,v 4.2 88/06/29 14:58:34 hagens Exp $ */
/* $Source: /usr/argo/sys/netargo/RCS/clnp_debug.c,v $ */
#include "../net/route.h"
{0x00, 0x02, 0x00, 0x10, 0x20, 0x30, 0x35},
{0x01, 0x02, 0x03, 0x04, 0x50, 0x60, 0x70, 0x80, 0x90}
struct addr_osinet u_osinet
= {
{0x00, 0x02, 0x00, 0x01, 0x23, 0x42, 0x78, 0x20, 0x01, 0x05, 0x00}
struct addr_rfc986 u_rfc986
= {
{0x01, 0xc0, 0x0c, 0x0c, 0xab, 0x11}
struct addr_rfc986 u_bad
= {
{0x01, 0xc0, 0x0c, 0x0c, 0xab, 0x11}
printf("type 37: %s\n", clnp_iso_addrp(&a
));
a
.isoa_u
.addr_osinet
= u_osinet
;
printf("type osinet: %s\n", clnp_iso_addrp(&a
));
a
.isoa_u
.addr_rfc986
= u_rfc986
;
printf("type rfc986: %s\n", clnp_iso_addrp(&a
));
a
.isoa_u
.addr_rfc986
= u_rfc986
;
printf("type bad afi: %s\n", clnp_iso_addrp(&a
));
a
.isoa_u
.addr_rfc986
= u_bad
;
printf("type bad idi: %s\n", clnp_iso_addrp(&a
));
static char letters
[] = "0123456789abcdef";
* Print buffer in hex, return addr of where we left off.
clnp_hexp(src
, len
, where
)
char *src
; /* src of data to print */
int len
; /* lengthof src */
char *where
; /* where to put data */
register int j
= ((u_char
*)src
)[i
];
*where
++ = letters
[j
>> 4];
*where
++ = letters
[j
& 0x0f];
* Return a ptr to a human readable form of an iso addr
static char iso_addr_b
[50];
sprintf(iso_addr_b
, "[%d] ", isoa
->isoa_len
);
/* set cp to end of what we have */
cp
= clnp_hexp(isoa
->isoa_genaddr
, (int)isoa
->isoa_len
, cp
);
/* print type specific part */
cp
= clnp_hexp(isoa
->t37_idi
, ADDR37_IDI_LEN
, cp
);
cp
= clnp_hexp(isoa
->t37_dsp
, ADDR37_DSP_LEN
, cp
);
/* osinet and rfc986 have idi in the same place */
cp
= clnp_hexp(isoa
->rfc986_idi
, ADDROSINET_IDI_LEN
, cp
);
CTOH(isoa
->rfc986_idi
[0], isoa
->rfc986_idi
[1], idi
);
struct ovl_osinet
*oosi
= (struct ovl_osinet
*)isoa
;
cp
= clnp_hexp(oosi
->oosi_orgid
, OVLOSINET_ORGID_LEN
, cp
);
cp
= clnp_hexp(oosi
->oosi_snetid
, OVLOSINET_SNETID_LEN
, cp
);
cp
= clnp_hexp(oosi
->oosi_snpa
, OVLOSINET_SNPA_LEN
, cp
);
cp
= clnp_hexp(oosi
->oosi_nsap
, OVLOSINET_NSAP_LEN
, cp
);
} else if (idi
== IDI_RFC986
) {
struct ovl_rfc986
*o986
= (struct ovl_rfc986
*)isoa
;
cp
= clnp_hexp(&o986
->o986_vers
, 1, cp
);
sprintf(cp
, "%d.%d.%d.%d.%d",
o986
->o986_inetaddr
[0] & 0xff,
o986
->o986_inetaddr
[1] & 0xff,
o986
->o986_inetaddr
[2] & 0xff,
o986
->o986_inetaddr
[3] & 0xff,
cp
= clnp_hexp(&o986
->o986_inetaddr
[0], 1, cp
);
cp
= clnp_hexp(&o986
->o986_inetaddr
[1], 1, cp
);
cp
= clnp_hexp(&o986
->o986_inetaddr
[2], 1, cp
);
cp
= clnp_hexp(&o986
->o986_inetaddr
[3], 1, cp
);
cp
= clnp_hexp(&o986
->o986_upid
, 1, cp
);
register struct sockaddr_iso
*s
;
register char *cp
= clnp_iso_addrp(&s
->siso_addr
);
cp
= clnp_hexp(TSEL(s
), (int)s
->siso_tlen
, cp
);