BSD 4_3_Net_2 release
[unix-history] / usr / src / sys / netiso / iso.h
index ec870c6..6485814 100644 (file)
@@ -1,3 +1,38 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)iso.h       7.6 (Berkeley) 5/6/91
+ */
+
 /***********************************************************
                Copyright IBM Corporation 1987
 
 /***********************************************************
                Copyright IBM Corporation 1987
 
@@ -26,7 +61,6 @@ SOFTWARE.
  */
 /* $Header: iso.h,v 4.9 88/09/11 18:06:38 hagens Exp $ */
 /* $Source: /usr/argo/sys/netiso/RCS/iso.h,v $ */
  */
 /* $Header: iso.h,v 4.9 88/09/11 18:06:38 hagens Exp $ */
 /* $Source: /usr/argo/sys/netiso/RCS/iso.h,v $ */
-/*     @(#)iso.h       7.2 (Berkeley) %G% */
 
 #ifndef __ISO__
 #define __ISO__
 
 #ifndef __ISO__
 #define __ISO__
@@ -55,6 +89,7 @@ SOFTWARE.
 #define        ISOPROTO_X25    32              /* cons */
 #define        ISOPROTO_INACT_NL       33      /* inactive network layer! */
 #define        ISOPROTO_ESIS   34              /* ES-IS protocol */
 #define        ISOPROTO_X25    32              /* cons */
 #define        ISOPROTO_INACT_NL       33      /* inactive network layer! */
 #define        ISOPROTO_ESIS   34              /* ES-IS protocol */
+#define        ISOPROTO_INTRAISIS      35              /* IS-IS protocol */
 
 #define        ISOPROTO_RAW    255             /* raw clnp */
 #define        ISOPROTO_MAX    256
 
 #define        ISOPROTO_RAW    255             /* raw clnp */
 #define        ISOPROTO_MAX    256
@@ -85,210 +120,47 @@ SOFTWARE.
 #define ISO8473_CLNP   0x81
 #define        ISO9542_ESIS    0x82
 #define ISO9542X25_ESIS        0x8a
 #define ISO8473_CLNP   0x81
 #define        ISO9542_ESIS    0x82
 #define ISO9542X25_ESIS        0x8a
+#define ISO10589_ISIS          0x83
+
 
 #ifndef IN_CLASSA_NET
 #include "../netinet/in.h"
 #endif IN_CLASSA_NET
 
 
 #ifndef IN_CLASSA_NET
 #include "../netinet/in.h"
 #endif IN_CLASSA_NET
 
-/*
- *     Type 37 Address
- *
- *     This address is named for the value of its AFI (37). This format
- *     supports an X.121 address. A type 37 address has the following format:
- *
- *  <----- idp -------> <- dsp ->
- *  <- afi -> <- idi -> <- dsp ->
- *  | "37"   | 7 bytes | 9 bytes |
- *
- *     The idi contains 14 bcd digits of X.121 address.
- *     The use of the dsp part is unknown.
- *
- *     The afi is considered the "network" portion of the address.
- *  This means that you can't have multihoming in the x.25 environment.
- *  Makes loopback a bear.
- */
-#define BIGSOCKADDRS
-#ifdef BIGSOCKADDRS
-#define        ADDR37_IDI_LEN          7                       /* 14 bcd digits == 7 octets */
-#define        ADDR37_DSP_LEN          9
-#else
-#define        ADDR37_IDI_LEN          7                       /* 14 bcd digits == 7 octets */
-#define        ADDR37_DSP_LEN          3                       /* this is a lie to fit in sockaddr */
-#endif BIGSOCKADDRS
-struct addr_37 {
-       u_char a37_idi[ADDR37_IDI_LEN];         /* initial domain identifier */
-       u_char a37_dsp[ADDR37_DSP_LEN];         /* domain specific part */
-};
-
-struct ovl_37 {        /* overlay for type 37 address */
-       u_char  o37_afi;                                        /* afi */
-       u_char  o37_x121[ADDR37_IDI_LEN];       /* X.121 address */
-       u_char  o37_dsp[ADDR37_DSP_LEN];        /* unknown use at this time */
-};
-
-/*
- *     OSINET address
- *
- *     This style address is used by the OSINET group
- *     An OSINET address has the following (variable-length) format
- *
- *  <----- idp ------->  <---------------- dsp --------------------------->
- *  <- afi -> <- idi ->  <---------------- dsp --------------------------->
- *  | "47"   | "0004"   |             11 bytes                            |
- *  |  afi(1)| osinetid | orgid(2) | subnet id(2) | (4-8) | nsap sel(1) |
- *
- *     the afi, orgid, and subnet id are considered the "network" portion of
- *     the address.
- */
-#ifdef BIGSOCKADDRS
-#define ADDROSINET_IDI_LEN             2
-#define ADDROSINET_DSP_LEN             11
-#else
-#define ADDROSINET_IDI_LEN             2
-#define ADDROSINET_DSP_LEN             8               /* this is a lie to fit in sockaddr */
-#endif BIGSOCKADDRS
-struct addr_osinet {
-       u_char aosi_idi[ADDROSINET_IDI_LEN];            /* initial domain identifier */
-       u_char aosi_dsp[ADDROSINET_DSP_LEN];            /* domain specific part */
-};
 
 
-#define        OVLOSINET_ID_LEN                2
-#ifdef BIGSOCKADDRS
-#define        OVLOSINET_ORGID_LEN             2
-#define        OVLOSINET_SNETID_LEN    2
-#define        OVLOSINET_SNPA_LEN              8
-#define        OVLOSINET_NSAP_LEN              1
-#else
-#define        OVLOSINET_ORGID_LEN             2
-#define        OVLOSINET_SNETID_LEN    2
-#define        OVLOSINET_SNPA_LEN              5               /* this is a lie to fit in sockaddr */
-#define        OVLOSINET_NSAP_LEN              1
-#endif BIGSOCKADDRS
-struct ovl_osinet { /* overlay for osinet address */
-       u_char  oosi_afi;                                                       /* afi */
-       u_char  oosi_id[OVLOSINET_ID_LEN];                      /* osinet id */
-       u_char  oosi_orgid[OVLOSINET_ORGID_LEN];        /* orgid */
-       u_char  oosi_snetid[OVLOSINET_SNETID_LEN];      /* subnet id */
-       u_char  oosi_snpa[OVLOSINET_SNPA_LEN];          /* snpa */
-       u_char  oosi_nsap[OVLOSINET_NSAP_LEN];          /* nsap sel */
-};
-
-/*
- *     RFC 986 address
- *
- *     This style address is used when DOD internet addresses are used
- *     The format of rfc986 addresses is:
- *
- *  <----- idp -------> <---------------- dsp -------------------->
- *  <- afi -> <- idi -> <---------------- dsp -------------------->
- *  | "47"   | "0006"  |             6 bytes                       |
- *  |  afi(1)| idi(2)  | version (1) | inet addr (4) | proto id(1) |
- *
- *     the afi, idi, and network portion of the inet address are considered 
- *     the "network" portion of the address.
- */
-#define ADDRRFC986_IDI_LEN             2
-#define ADDRRFC986_DSP_LEN             6
-struct addr_rfc986 {
-       u_char  a986_idi[ADDRRFC986_IDI_LEN];           /* initial domain identifier */
-       u_char  a986_dsp[ADDRRFC986_DSP_LEN];           /* domain specific part */
-};
-
-#define        OVLRFC986_INET_LEN              4
-struct ovl_rfc986 {
-       u_char  o986_afi;                                                       /* afi */
-       u_char  o986_idi[ADDRRFC986_IDI_LEN];           /* idi */
-       u_char  o986_vers;                                                      /* version */
-       u_char  o986_inetaddr[OVLRFC986_INET_LEN];      /* internet address */
-       u_char  o986_upid;                                                      /* upper protocol id */
-};
-#define RFC986V1                               0x01                    /* version of 986 addr */
-
-#define        AFI_37          0x37    /* bcd of "37" */
-#define AFI_OSINET     0x47    /* bcd of "47" */
-#define AFI_RFC986     0x47    /* bcd of "47" */
-#define        AFI_SNA         0x00    /* SubNetwork Address; invalid really...
-                                                               - used by ES-IS */
-
-/* the idi for type 37 addresses is very different than the others */
-#define        IDI_OSINET      0x0004  /* bcd of "0004" */     
-#define        IDI_RFC986      0x0006  /* bcd of "0006" */
-
-/*
- *     This address type is used to store a subnetwork address in a 
- *     sockaddr_iso. The isoa_len field should contain the length of the
- *     subnetwork address plus the length of the afi (ie +1 ).
- *
- *     This address format is used only by the ES-IS protocol
- */
-#define        ADDRSNA_IDI_LEN         7
-struct addr_sn {
-       char    sna_addr[ADDRSNA_IDI_LEN];              /* subnetwork address */
-};
-
-/* 
- *     Type 47 is the biggest address: 11 bytes. The length of iso_addr
- *     is 13 bytes.
- */
-struct old_iso_addr {
-       u_char  isoa_afi;                                               /* authority and format id */
-       union {
-               struct addr_37          addr_37;                /* type 37 */
-               struct addr_osinet      addr_osinet;    /* type osinet */
-               struct addr_rfc986      addr_rfc986;    /* type rfc986 */
-               struct addr_sn          addr_sn;                /* subnetwork address */
-       }               isoa_u;
-       u_char  isoa_len;                                               /* length (in bytes) */
-};
 
 /* The following looks like a sockaddr
 
 /* The following looks like a sockaddr
- * in case we decide to use tree routines */
+ * to facilitate using tree lookup routines */
 struct iso_addr {
        u_char  isoa_len;                                               /* length (in bytes) */
        char    isoa_genaddr[20];                               /* general opaque address */
 };
 
 struct iso_addr {
        u_char  isoa_len;                                               /* length (in bytes) */
        char    isoa_genaddr[20];                               /* general opaque address */
 };
 
-#define t37_idi                isoa_u.addr_37.a37_idi
-#define        t37_dsp         isoa_u.addr_37.a37_dsp
-#define osinet_idi     isoa_u.addr_osinet.aosi_idi
-#define        osinet_dsp      isoa_u.addr_osinet.aosi_dsp
-#define        rfc986_idi      isoa_u.addr_rfc986.a986_idi
-#define        rfc986_dsp      isoa_u.addr_rfc986.a986_dsp
-#define sna_idi                isoa_u.addr_sn.sna_addr
-
-/*
- *     An iso_addr is 18 bytes, a sockaddr_iso is therefore 20 bytes.
- *     the struct sockaddr data field has been changed to 22 bytes.
- *
- * severly changed osinet and t37 addresses from argo code, we don't want
- * sockaddrs to grow bigger than the original 16 bytes so we changed the 
- * t37 and osinet addresses so that they were only 10 bytes long
- */
 struct sockaddr_iso {
        u_char                          siso_len;                       /* length */
        u_char                          siso_family;            /* family */
 struct sockaddr_iso {
        u_char                          siso_len;                       /* length */
        u_char                          siso_family;            /* family */
-       u_char                          siso_ssuffixlen;        /* session suffix len */
-       u_char                          siso_tsuffixlen;        /* transport suffix len */
-/*  u_char                             siso_nsaptype;          /* someday?? */
+       u_char                          siso_plen;                      /* presentation selector length */
+       u_char                          siso_slen;                      /* session selector length */
+       u_char                          siso_tlen;                      /* transport selector length */
        struct  iso_addr        siso_addr;                      /* network address */
        struct  iso_addr        siso_addr;                      /* network address */
-       u_char                          siso_pad[3];            /* make multiple of sizeof long */
+       u_char                          siso_pad[6];            /* space for gosip v2 sels */
+                                                                                       /* makes struct 32 bytes long */
 };
 };
-
-#define siso_data siso_addr.isoa_genaddr
 #define siso_nlen siso_addr.isoa_len
 #define siso_nlen siso_addr.isoa_len
+#define siso_data siso_addr.isoa_genaddr
+
 #define TSEL(s) ((caddr_t)((s)->siso_data + (s)->siso_nlen))
 
 #define SAME_ISOADDR(a, b) \
        (bcmp((a)->siso_data, (b)->siso_data, (unsigned)(a)->siso_nlen)==0)
 #define TSEL(s) ((caddr_t)((s)->siso_data + (s)->siso_nlen))
 
 #define SAME_ISOADDR(a, b) \
        (bcmp((a)->siso_data, (b)->siso_data, (unsigned)(a)->siso_nlen)==0)
-
-#define NSAPTYPE_UNKNOWN       -1
-#define NSAPTYPE_INET          0
-#define NSAPTYPE_X121BCD       1
-#define NSAPTYPE_X121BIN       2
-#define NSAPTYPE_DCCBCD                3
-#define NSAPTYPE_DCCBIN                4
-#define NSAPTYPE_OSINET        5
-#define NSAPTYPE_RFC986        6
+/*
+ * The following are specific values for siso->siso_data[0],
+ * otherwise known as the AFI:
+ */
+#define        AFI_37          0x37    /* bcd of "37" */
+#define AFI_OSINET     0x47    /* bcd of "47" */
+#define AFI_RFC986     0x47    /* bcd of "47" */
+#define        AFI_SNA         0x00    /* SubNetwork Address; invalid really...*/
 
 #ifdef KERNEL
 
 
 #ifdef KERNEL
 
@@ -302,10 +174,17 @@ extern    struct protosw isosw[];
 #else
 /* user utilities definitions from the iso library */
 
 #else
 /* user utilities definitions from the iso library */
 
-char *iso_ntoa();
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+struct iso_addr *iso_addr __P((const char *));
+char *iso_ntoa __P((const struct iso_addr *));
+
+/* THESE DON'T EXIST YET */
 struct hostent *iso_gethostbyname(), *iso_gethostbyaddr();
 struct hostent *iso_gethostbyname(), *iso_gethostbyaddr();
+__END_DECLS
 
 
-#endif KERNEL
+#endif /* KERNEL */
 
 
-#endif __ISO__
 #define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m))
 #define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m))
+#endif __ISO__