149268Sbostic /*- 2*67464Ssklower * Copyright (c) 1991, 1993, 1994 363222Sbostic * The Regents of the University of California. All rights reserved. 449268Sbostic * 549268Sbostic * %sccs.include.redist.c% 649268Sbostic * 7*67464Ssklower * @(#)iso.h 8.2 (Berkeley) 06/30/94 849268Sbostic */ 949268Sbostic 1036385Ssklower /*********************************************************** 1136385Ssklower Copyright IBM Corporation 1987 1236385Ssklower 1336385Ssklower All Rights Reserved 1436385Ssklower 1536385Ssklower Permission to use, copy, modify, and distribute this software and its 1636385Ssklower documentation for any purpose and without fee is hereby granted, 1736385Ssklower provided that the above copyright notice appear in all copies and that 1836385Ssklower both that copyright notice and this permission notice appear in 1936385Ssklower supporting documentation, and that the name of IBM not be 2036385Ssklower used in advertising or publicity pertaining to distribution of the 2136385Ssklower software without specific, written prior permission. 2236385Ssklower 2336385Ssklower IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 2436385Ssklower ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 2536385Ssklower IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 2636385Ssklower ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 2736385Ssklower WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 2836385Ssklower ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 2936385Ssklower SOFTWARE. 3036385Ssklower 3136385Ssklower ******************************************************************/ 3236385Ssklower 3336385Ssklower /* 3436385Ssklower * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison 3536385Ssklower */ 3636385Ssklower /* $Header: iso.h,v 4.9 88/09/11 18:06:38 hagens Exp $ */ 3736385Ssklower /* $Source: /usr/argo/sys/netiso/RCS/iso.h,v $ */ 3836385Ssklower 3936385Ssklower #ifndef __ISO__ 4036385Ssklower #define __ISO__ 4136385Ssklower 4236385Ssklower /* 4336385Ssklower * Return true if this is a multicast address 4436385Ssklower * This assumes that the bit transmission is lsb first. This 4536385Ssklower * assumption is valid for 802.3 but not 802.5. There is a 4636385Ssklower * kludge to get around this for 802.5 -- see if_lan.c 4736385Ssklower * where subnetwork header is setup. 4836385Ssklower */ 4936385Ssklower #define IS_MULTICAST(snpa)\ 5036385Ssklower ((snpa)[0] & 0x01) 5136385Ssklower 5236385Ssklower /* 5336385Ssklower * Protocols 5436385Ssklower */ 5556910Ssklower #define ISOPROTO_TCP 6 /* IETF experiment */ 5656910Ssklower #define ISOPROTO_UDP 17 /* IETF experiment */ 5736385Ssklower #define ISOPROTO_TP0 25 /* connection oriented transport protocol */ 5836385Ssklower #define ISOPROTO_TP1 26 /* not implemented */ 5936385Ssklower #define ISOPROTO_TP2 27 /* not implemented */ 6036385Ssklower #define ISOPROTO_TP3 28 /* not implemented */ 6136385Ssklower #define ISOPROTO_TP4 29 /* connection oriented transport protocol */ 6236385Ssklower #define ISOPROTO_TP ISOPROTO_TP4 /* tp-4 with negotiation */ 6336385Ssklower #define ISOPROTO_CLTP 30 /* connectionless transport (not yet impl.) */ 6436385Ssklower #define ISOPROTO_CLNP 31 /* connectionless internetworking protocol */ 6536385Ssklower #define ISOPROTO_X25 32 /* cons */ 6636385Ssklower #define ISOPROTO_INACT_NL 33 /* inactive network layer! */ 6736385Ssklower #define ISOPROTO_ESIS 34 /* ES-IS protocol */ 6843423Ssklower #define ISOPROTO_INTRAISIS 35 /* IS-IS protocol */ 6956910Ssklower #define ISOPROTO_IDRP 36 /* Interdomain Routing Protocol */ 7036385Ssklower 7136385Ssklower #define ISOPROTO_RAW 255 /* raw clnp */ 7236385Ssklower #define ISOPROTO_MAX 256 7336385Ssklower 7436385Ssklower #define ISO_PORT_RESERVED 1024 7536385Ssklower #define ISO_PORT_USERRESERVED 5000 7636385Ssklower /* 7736385Ssklower * Port/socket numbers: standard network functions 7836385Ssklower * NOT PRESENTLY USED 7936385Ssklower */ 8036385Ssklower #define ISO_PORT_MAINT 501 8136385Ssklower #define ISO_PORT_ECHO 507 8236385Ssklower #define ISO_PORT_DISCARD 509 8336385Ssklower #define ISO_PORT_SYSTAT 511 8436385Ssklower #define ISO_PORT_NETSTAT 515 8536385Ssklower /* 8636385Ssklower * Port/socket numbers: non-standard application functions 8736385Ssklower */ 8836385Ssklower #define ISO_PORT_LOGIN 513 8936385Ssklower /* 9036385Ssklower * Port/socket numbers: public use 9136385Ssklower */ 9236385Ssklower #define ISO_PORT_PUBLIC 1024 /* high bit set --> public */ 9336385Ssklower 9436385Ssklower /* 9536385Ssklower * Network layer protocol identifiers 9636385Ssklower */ 9736385Ssklower #define ISO8473_CLNP 0x81 9836385Ssklower #define ISO9542_ESIS 0x82 9936385Ssklower #define ISO9542X25_ESIS 0x8a 10043423Ssklower #define ISO10589_ISIS 0x83 10156910Ssklower #define ISO8878A_CONS 0x84 10256910Ssklower #define ISO10747_IDRP 0x85 10336385Ssklower 10438841Ssklower 10536385Ssklower #ifndef IN_CLASSA_NET 10656533Sbostic #include <netinet/in.h> 10760359Sbostic #endif /* IN_CLASSA_NET */ 10836385Ssklower 10936385Ssklower 11036385Ssklower 11137469Ssklower /* The following looks like a sockaddr 11238841Ssklower * to facilitate using tree lookup routines */ 11337469Ssklower struct iso_addr { 11437469Ssklower u_char isoa_len; /* length (in bytes) */ 11537469Ssklower char isoa_genaddr[20]; /* general opaque address */ 11637469Ssklower }; 11737469Ssklower 11836385Ssklower struct sockaddr_iso { 11937469Ssklower u_char siso_len; /* length */ 12037469Ssklower u_char siso_family; /* family */ 12138841Ssklower u_char siso_plen; /* presentation selector length */ 12238841Ssklower u_char siso_slen; /* session selector length */ 12338841Ssklower u_char siso_tlen; /* transport selector length */ 12436385Ssklower struct iso_addr siso_addr; /* network address */ 12538841Ssklower u_char siso_pad[6]; /* space for gosip v2 sels */ 12638841Ssklower /* makes struct 32 bytes long */ 12736385Ssklower }; 12838841Ssklower #define siso_nlen siso_addr.isoa_len 12938841Ssklower #define siso_data siso_addr.isoa_genaddr 13036385Ssklower 13137469Ssklower #define TSEL(s) ((caddr_t)((s)->siso_data + (s)->siso_nlen)) 13237469Ssklower 13337469Ssklower #define SAME_ISOADDR(a, b) \ 134*67464Ssklower (bcmp((a)->siso_data, (b)->siso_data, (unsigned)(a)->siso_nlen) == 0) 135*67464Ssklower #define SAME_ISOIFADDR(a, b) (bcmp((a)->siso_data, (b)->siso_data, \ 136*67464Ssklower (unsigned)((b)->siso_nlen - (b)->siso_tlen)) == 0) 13738841Ssklower /* 13838841Ssklower * The following are specific values for siso->siso_data[0], 13938841Ssklower * otherwise known as the AFI: 14038841Ssklower */ 14138841Ssklower #define AFI_37 0x37 /* bcd of "37" */ 14238841Ssklower #define AFI_OSINET 0x47 /* bcd of "47" */ 14338841Ssklower #define AFI_RFC986 0x47 /* bcd of "47" */ 14438841Ssklower #define AFI_SNA 0x00 /* SubNetwork Address; invalid really...*/ 14537469Ssklower 14636385Ssklower #ifdef KERNEL 14736385Ssklower 14836385Ssklower extern int iso_netmatch(); 14936385Ssklower extern int iso_hash(); 15036385Ssklower extern int iso_addrmatch(); 15136385Ssklower extern struct iso_ifaddr *iso_iaonnetof(); 15236385Ssklower extern struct domain isodomain; 15336385Ssklower extern struct protosw isosw[]; 15436385Ssklower 15536385Ssklower #else 15636385Ssklower /* user utilities definitions from the iso library */ 15736385Ssklower 15846529Sdonn #include <sys/cdefs.h> 15946529Sdonn 16046529Sdonn __BEGIN_DECLS 16146529Sdonn struct iso_addr *iso_addr __P((const char *)); 16246529Sdonn char *iso_ntoa __P((const struct iso_addr *)); 16346529Sdonn 16446529Sdonn /* THESE DON'T EXIST YET */ 16536385Ssklower struct hostent *iso_gethostbyname(), *iso_gethostbyaddr(); 16646529Sdonn __END_DECLS 16736385Ssklower 16846529Sdonn #endif /* KERNEL */ 16936385Ssklower 17038841Ssklower #define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m)) 17160359Sbostic #endif /* __ISO__ */ 172