main() { struct iso_addr a; a.isoa_afi = AFI_37; a.isoa_u.addr_37 = u_37; a.isoa_len = 17; printf("type 37: %s\n", clnp_iso_addrp(&a)); a.isoa_afi = AFI_OSINET; a.isoa_u.addr_osinet = u_osinet; a.isoa_len = 14; printf("type osinet: %s\n", clnp_iso_addrp(&a)); a.isoa_afi = AFI_RFC986; a.isoa_u.addr_rfc986 = u_rfc986; a.isoa_len = 9; printf("type rfc986: %s\n", clnp_iso_addrp(&a)); a.isoa_afi = 12; a.isoa_u.addr_rfc986 = u_rfc986; a.isoa_len = 9; printf("type bad afi: %s\n", clnp_iso_addrp(&a)); a.isoa_afi = AFI_RFC986; a.isoa_u.addr_rfc986 = u_bad; a.isoa_len = 9; printf("type bad idi: %s\n", clnp_iso_addrp(&a)); }
/* * FUNCTION: iso_hash * * PURPOSE: Fill in fields of afhash structure based upon addr * passed. * * RETURNS: none * * SIDE EFFECTS: * * NOTES: */ void iso_hash( struct sockaddr_iso *siso, /* address to perform hash on */ struct afhash *hp) /* RETURN: hash info here */ { u_long buf[sizeof(struct sockaddr_iso) / 4 + 1]; int bufsize; bzero(buf, sizeof(buf)); bufsize = iso_netof(&siso->siso_addr, buf); hp->afh_nethash = iso_hashchar((void *) buf, bufsize); #ifdef ARGO_DEBUG if (argo_debug[D_ROUTE]) { printf("iso_hash: iso_netof: bufsize = %d\n", bufsize); } #endif hp->afh_hosthash = iso_hashchar((void *) & siso->siso_addr, siso->siso_addr.isoa_len); #ifdef ARGO_DEBUG if (argo_debug[D_ROUTE]) { printf("iso_hash: %s: nethash = x%x, hosthash = x%x\n", clnp_iso_addrp(&siso->siso_addr), hp->afh_nethash, hp->afh_hosthash); } #endif }
char * clnp_saddr_isop(const struct sockaddr_iso *s) { char *cp = clnp_iso_addrp(&s->siso_addr); while (*cp) cp++; *cp++ = '('; cp = clnp_hexp(TSEL(s), (int) s->siso_tlen, cp); *cp++ = ')'; *cp++ = 0; return (iso_addr_b); }
/* * FUNCTION: clnp_er_input * * PURPOSE: Process an ER pdu. * * RETURNS: * * SIDE EFFECTS: * * NOTES: */ void clnp_er_input( struct mbuf *m, /* ptr to packet itself */ struct iso_addr *src, /* ptr to src of er */ u_int reason) /* reason code of er */ { int cmd = -1; #ifdef ARGO_DEBUG if (argo_debug[D_CTLINPUT]) { printf("clnp_er_input: m %p, src %s, reason x%x\n", m, clnp_iso_addrp(src), reason); } #endif INCSTAT(cns_er_inhist[clnp_er_index(reason)]); switch (reason) { case GEN_NOREAS: case GEN_PROTOERR: break; case GEN_BADCSUM: cmd = PRC_PARAMPROB; break; case GEN_CONGEST: cmd = PRC_QUENCH; break; case GEN_HDRSYNTAX: cmd = PRC_PARAMPROB; break; case GEN_SEGNEEDED: cmd = PRC_MSGSIZE; break; case GEN_INCOMPLETE: cmd = PRC_PARAMPROB; break; case GEN_DUPOPT: cmd = PRC_PARAMPROB; break; case ADDR_DESTUNREACH: cmd = PRC_UNREACH_HOST; break; case ADDR_DESTUNKNOWN: cmd = PRC_UNREACH_PROTOCOL; break; case SRCRT_UNSPECERR: case SRCRT_SYNTAX: case SRCRT_UNKNOWNADDR: case SRCRT_BADPATH: cmd = PRC_UNREACH_SRCFAIL; break; case TTL_EXPTRANSIT: cmd = PRC_TIMXCEED_INTRANS; break; case TTL_EXPREASS: cmd = PRC_TIMXCEED_REASS; break; case DISC_UNSUPPOPT: case DISC_UNSUPPVERS: case DISC_UNSUPPSECURE: case DISC_UNSUPPSRCRT: case DISC_UNSUPPRECRT: cmd = PRC_PARAMPROB; break; case REASS_INTERFERE: cmd = PRC_TIMXCEED_REASS; break; } /* * tpclnp_ctlinput1 is called directly so that we don't * have to build an iso_sockaddr out of src. */ if (cmd >= 0) tpclnp_ctlinput1(cmd, src); m_freem(m); }