home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / darwin / darwinx86.iso / usr / include / netiso / eonvar.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-30  |  6.6 KB  |  192 lines

  1. /*
  2.  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
  3.  *
  4.  * @APPLE_LICENSE_HEADER_START@
  5.  * 
  6.  * The contents of this file constitute Original Code as defined in and
  7.  * are subject to the Apple Public Source License Version 1.1 (the
  8.  * "License").  You may not use this file except in compliance with the
  9.  * License.  Please obtain a copy of the License at
  10.  * http://www.apple.com/publicsource and read it before using this file.
  11.  * 
  12.  * This Original Code and all software distributed under the License are
  13.  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  14.  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  15.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  16.  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
  17.  * License for the specific language governing rights and limitations
  18.  * under the License.
  19.  * 
  20.  * @APPLE_LICENSE_HEADER_END@
  21.  */
  22. /*-
  23.  * Copyright (c) 1991, 1993
  24.  *    The Regents of the University of California.  All rights reserved.
  25.  *
  26.  * Redistribution and use in source and binary forms, with or without
  27.  * modification, are permitted provided that the following conditions
  28.  * are met:
  29.  * 1. Redistributions of source code must retain the above copyright
  30.  *    notice, this list of conditions and the following disclaimer.
  31.  * 2. Redistributions in binary form must reproduce the above copyright
  32.  *    notice, this list of conditions and the following disclaimer in the
  33.  *    documentation and/or other materials provided with the distribution.
  34.  * 3. All advertising materials mentioning features or use of this software
  35.  *    must display the following acknowledgement:
  36.  *    This product includes software developed by the University of
  37.  *    California, Berkeley and its contributors.
  38.  * 4. Neither the name of the University nor the names of its contributors
  39.  *    may be used to endorse or promote products derived from this software
  40.  *    without specific prior written permission.
  41.  *
  42.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  43.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  44.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  45.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  46.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  47.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  48.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  49.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  50.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  51.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  52.  * SUCH DAMAGE.
  53.  *
  54.  *    @(#)eonvar.h    8.1 (Berkeley) 6/10/93
  55.  */
  56.  
  57. /***********************************************************
  58.         Copyright IBM Corporation 1987
  59.  
  60.                       All Rights Reserved
  61.  
  62. Permission to use, copy, modify, and distribute this software and its 
  63. documentation for any purpose and without fee is hereby granted, 
  64. provided that the above copyright notice appear in all copies and that
  65. both that copyright notice and this permission notice appear in 
  66. supporting documentation, and that the name of IBM not be
  67. used in advertising or publicity pertaining to distribution of the
  68. software without specific, written prior permission.  
  69.  
  70. IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  71. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  72. IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  73. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  74. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  75. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  76. SOFTWARE.
  77.  
  78. ******************************************************************/
  79.  
  80. /*
  81.  * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
  82.  */
  83.  
  84. #define EON_986_VERSION 0x3
  85. #define EON_VERSION 0x1
  86.  
  87. #define EON_CACHESIZE 30
  88.  
  89. #define E_FREE     1
  90. #define E_LINK    2
  91. #define E_ES     3
  92. #define E_IS     4
  93.  
  94.  
  95. /* 
  96.  * this overlays a sockaddr_iso
  97.  */
  98.  
  99. struct sockaddr_eon {
  100.     u_char             seon_len;    /* Length */
  101.     u_char             seon_family;    /* AF_ISO */
  102.     u_char            seon_status;    /* overlays session suffixlen */
  103. #define EON_ESLINK_UP        0x1
  104. #define EON_ESLINK_DOWN        0x2
  105. #define EON_ISLINK_UP        0x10
  106. #define EON_ISLINK_DOWN        0x20
  107. /* no change is neither up or down */
  108.     u_char            seon_pad1;    /* 0, overlays tsfxlen */
  109.     u_char            seon_adrlen;
  110.     u_char            seon_afi;        /* 47 */
  111.     u_char            seon_idi[2];    /* 0006 */
  112.     u_char            seon_vers;        /* 03 */
  113.     u_char            seon_glbnum[2];    /* see RFC 1069 */
  114.     u_char            seon_RDN[2];    /* see RFC 1070 */
  115.     u_char            seon_pad2[3];    /* see RFC 1070 */
  116.     u_char            seon_LAREA[2];    /* see RFC 1070 */
  117.     u_char            seon_pad3[2];    /* see RFC 1070 */
  118.         /* right now ip addr is  aligned  -- be careful --
  119.          * future revisions may have it u_char[4]
  120.          */
  121.     u_int            seon_ipaddr;    /* a.b.c.d */
  122.     u_char            seon_protoid;    /* NSEL */
  123. };
  124.  
  125. #ifdef EON_TEMPLATE
  126. struct sockaddr_eon eon_template = {
  127.     sizeof (eon_template), AF_ISO, 0, 0, 0x14,
  128.     0x47, 0x0, 0x6, 0x3, 0
  129. };
  130. #endif
  131.  
  132. #define DOWNBITS ( EON_ESLINK_DOWN | EON_ISLINK_DOWN )
  133. #define UPBITS ( EON_ESLINK_UP | EON_ISLINK_UP )
  134.  
  135. #define    SIOCSEONCORE _IOWR('i',10, struct iso_ifreq) /* EON core member */
  136. #define    SIOCGEONCORE _IOWR('i',11, struct iso_ifreq) /* EON core member */
  137.  
  138. struct eon_hdr {
  139.     u_char     eonh_vers; /* value 1 */
  140.     u_char     eonh_class;  /* address multicast class, below */
  141. #define        EON_NORMAL_ADDR        0x0
  142. #define        EON_MULTICAST_ES    0x1
  143. #define        EON_MULTICAST_IS    0x2
  144. #define        EON_BROADCAST        0x3
  145.     u_short eonh_csum;  /* osi checksum (choke)*/
  146. };
  147. struct eon_iphdr {
  148.     struct    ip    ei_ip;
  149.     struct    eon_hdr    ei_eh;
  150. };
  151. #define EONIPLEN (sizeof(struct eon_hdr) + sizeof(struct ip))
  152.  
  153. /* stole these 2 fields of the flags for I-am-ES and I-am-IS */
  154. #define    IFF_ES    0x400
  155. #define    IFF_IS    0x800
  156.  
  157. struct eon_stat {
  158.     int    es_in_multi_es;
  159.     int    es_in_multi_is;
  160.     int    es_in_broad;
  161.     int    es_in_normal;
  162.     int    es_out_multi_es;
  163.     int    es_out_multi_is;
  164.     int    es_out_broad;
  165.     int    es_out_normal;
  166.     int    es_ipout;
  167.  
  168.     int    es_icmp[PRC_NCMDS];
  169.     /* errors */
  170.     int    es_badcsum;
  171.     int    es_badhdr;
  172. } eonstat;
  173.  
  174. #undef IncStat
  175. #define IncStat(xxx) eonstat.xxx++
  176.  
  177. typedef struct qhdr {
  178.     struct qhdr *link, *rlink;
  179. } *queue_t;
  180.  
  181. struct eon_llinfo {
  182.     struct    qhdr el_qhdr;        /* keep all in a list */
  183.     int    el_flags;        /* cache valid ? */
  184.     int    el_snpaoffset;        /* IP address contained in dst nsap */
  185.     struct    rtentry *el_rt;        /* back pointer to parent route */
  186.     struct    eon_iphdr el_ei;    /* precomputed portion of hdr */
  187.     struct    route el_iproute;    /* if direct route cache IP info */
  188.                     /* if gateway, cache secondary route */
  189. };
  190. #define el_iphdr el_ei.ei_ip
  191. #define el_eonhdr el_ei.ei_eh
  192.