コード例 #1
0
ファイル: dgram.c プロジェクト: Kampbell/isode-8.0
static 
isoprint (struct sockaddr_iso *siso, char *bp)
{
	int	    didone = 0;

	if (siso -> siso_plen) {
		hexprint (bp, siso -> siso_plen, PSEL (siso), "'", "'H");
		bp += strlen (bp);
		*bp++ = '/';
		didone++;
	}
	if (siso -> siso_slen || didone) {
		hexprint (bp, siso -> siso_slen, SSEL (siso), "'", "'H");
		bp += strlen (bp);
		*bp++ = '/';
		didone++;
	}
	if (siso -> siso_tlen || didone) {
		hexprint (bp, siso -> siso_tlen, TSEL (siso), "'", "'H");
		bp += strlen (bp);
		*bp++ = '/';
		didone++;
	}
	hexprint (bp, siso -> siso_nlen, siso -> siso_data, "NS+", "");
}
コード例 #2
0
ファイル: af_iso.c プロジェクト: lacombar/netbsd-alc
/* fixup mask */
static int
iso_pre_aifaddr(prop_dictionary_t env, const struct afparam *param)
{
	struct sockaddr_iso *siso;

	siso = param->mask.buf;
	siso->siso_len = TSEL(siso) - (char *)(siso);
	siso->siso_nlen = 0;
	return 0;
}
コード例 #3
0
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);
}
コード例 #4
0
int
tp_pcbbind(void *v, struct mbuf *nam, struct lwp *l)
{
	struct tp_pcb *tpcb = v;
	struct sockaddr_iso *siso = 0;
	int             tlen = 0, wrapped = 0;
	const char *tsel = NULL;
	u_short         tutil;

	if (tpcb->tp_state != TP_CLOSED)
		return (EINVAL);
	if (nam) {
		siso = mtod(nam, struct sockaddr_iso *);
		switch (siso->siso_family) {
		default:
			return (EAFNOSUPPORT);
#ifdef ISO
		case AF_ISO:
			tlen = siso->siso_tlen;
			tsel = TSEL(siso);
			if (siso->siso_nlen == 0)
				siso = 0;
			break;
#endif
#ifdef INET
		case AF_INET:
			tsel = (void *) & tutil;
			if ((tutil = satosin(siso)->sin_port) != 0)
				tlen = 2;
			if (satosin(siso)->sin_addr.s_addr == 0)
				siso = 0;
#endif
		}
	}
	if (tpcb->tp_lsuffixlen == 0) {
		if (tlen) {
			if (tp_tselinuse(tlen, tsel, siso,
				  tpcb->tp_sock->so_options & SO_REUSEADDR))
				return (EINVAL);
		} else {
			for (tsel = (void *) & tutil, tlen = 2;;) {
				if (tp_unique++ < ISO_PORT_RESERVED ||
				    tp_unique > ISO_PORT_USERRESERVED) {
					if (wrapped++)
						return ESRCH;
					tp_unique = ISO_PORT_RESERVED;
				}
				tutil = htons(tp_unique);
				if (tp_tselinuse(tlen, tsel, siso, 0) == 0)
					break;
			}
			if (siso)
				switch (siso->siso_family) {
#ifdef ISO
				case AF_ISO:
					memcpy(WRITABLE_TSEL(siso), tsel, tlen);
					siso->siso_tlen = tlen;
					break;
#endif
#ifdef INET
				case AF_INET:
					satosin(siso)->sin_port = tutil;
#endif
				}
		}
		bcopy(tsel, tpcb->tp_lsuffix, (tpcb->tp_lsuffixlen = tlen));
		iso_insque(tpcb, &tp_bound_pcbs);
	} else {
		if (tlen || siso == 0)
			return (EINVAL);
	}
	if (siso == 0) {
		tpcb->tp_flags |= TPF_GENERAL_ADDR;
		return (0);
	}
	return (*tpcb->tp_nlproto->nlp_pcbbind)(tpcb->tp_npcb, nam, l);
}