The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netccitt/hdlc.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: hdlc.h,v 1.8 2003/08/07 16:33:01 agc Exp $     */
    2 
    3 /*-
    4  * Copyright (c) 1991, 1993
    5  *      The Regents of the University of California.  All rights reserved.
    6  *
    7  * This code is derived from software contributed to Berkeley by
    8  * the Laboratory for Computation Vision and the Computer Science Department
    9  * of the University of British Columbia.
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   14  * 1. Redistributions of source code must retain the above copyright
   15  *    notice, this list of conditions and the following disclaimer.
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  * 3. Neither the name of the University nor the names of its contributors
   20  *    may be used to endorse or promote products derived from this software
   21  *    without specific prior written permission.
   22  *
   23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   33  * SUCH DAMAGE.
   34  *
   35  *      @(#)hdlc.h      8.1 (Berkeley) 6/10/93
   36  */
   37 
   38 /*-
   39  * Copyright (c) 1984 University of British Columbia.
   40  *
   41  * This code is derived from software contributed to Berkeley by
   42  * the Laboratory for Computation Vision and the Computer Science Department
   43  * of the University of British Columbia.
   44  *
   45  * Redistribution and use in source and binary forms, with or without
   46  * modification, are permitted provided that the following conditions
   47  * are met:
   48  * 1. Redistributions of source code must retain the above copyright
   49  *    notice, this list of conditions and the following disclaimer.
   50  * 2. Redistributions in binary form must reproduce the above copyright
   51  *    notice, this list of conditions and the following disclaimer in the
   52  *    documentation and/or other materials provided with the distribution.
   53  * 3. All advertising materials mentioning features or use of this software
   54  *    must display the following acknowledgement:
   55  *      This product includes software developed by the University of
   56  *      California, Berkeley and its contributors.
   57  * 4. Neither the name of the University nor the names of its contributors
   58  *    may be used to endorse or promote products derived from this software
   59  *    without specific prior written permission.
   60  *
   61  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   62  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   63  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   64  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   65  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   66  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   67  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   68  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   69  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   70  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   71  * SUCH DAMAGE.
   72  *
   73  *      @(#)hdlc.h      8.1 (Berkeley) 6/10/93
   74  */
   75 
   76 #ifndef ORDER4
   77 #ifndef CCITT_TYPES_DEFINED
   78 #define CCITT_TYPES_DEFINED
   79 #define FALSE   0
   80 #define TRUE    1
   81 typedef u_char octet;
   82 typedef char    bool;
   83 #endif
   84 
   85 /*
   86  *  HDLC Packet format definitions
   87  *  This will eventually have to be rewritten without reference
   88  *  to bit fields, to be compliant with ANSI C and alignment safe.
   89  */
   90 
   91 #if BYTE_ORDER == BIG_ENDIAN
   92 #define ORDER4(a, b, c, d) a , b , c , d
   93 #define ORDER5(a, b, c, d, e) a , b , c , d , e
   94 #endif
   95 
   96 #if BYTE_ORDER == LITTLE_ENDIAN
   97 #define ORDER4(a, b, c, d) d , c , b , a
   98 #define ORDER5(a, b, c, d, e) e , d , c , b , a
   99 #endif
  100 #endif
  101 
  102 #define MAX_INFO_LEN    4096+3+4
  103 #define ADDRESS_A       3       /* B'00000011' */
  104 #define ADDRESS_B       1       /* B'00000001' */
  105 
  106 struct Hdlc_iframe {
  107         octet   address;
  108         octet   ORDER4(nr:3, pf:1, ns:3, hdlc_0:1);
  109         octet    i_field[MAX_INFO_LEN];
  110 };
  111 
  112 struct Hdlc_sframe {
  113         octet   address;
  114         octet   ORDER4(nr:3, pf:1, s2:2, hdlc_01:2);
  115 };
  116 
  117 struct  Hdlc_uframe {
  118         octet   address;
  119         octet   ORDER4(m3:3, pf:1, m2:2, hdlc_11:2);
  120 };
  121 
  122 struct  Frmr_frame {
  123         octet   address;
  124         octet   control;
  125         octet   frmr_control;
  126         octet   ORDER4(frmr_nr:3, frmr_f1_0:1, frmr_ns:3, frmr_f2_0:1);
  127         octet   ORDER5(frmr_0000:4, frmr_z:1, frmr_y:1, frmr_x:1, frmr_w:1);
  128 };
  129 
  130 #define HDHEADERLN      2
  131 #define MINFRLN         2               /* Minimum frame length. */
  132 
  133 struct  Hdlc_frame {
  134         octet   address;
  135         octet   control;
  136         octet   info[3];        /* min for FRMR */
  137 };
  138 
  139 #define SABM_CONTROL 057        /* B'00101111' */
  140 #define UA_CONTROL   0143       /* B'01100011' */
  141 #define DISC_CONTROL 0103       /* B'01000011' */
  142 #define DM_CONTROL   017        /* B'00001111' */
  143 #define FRMR_CONTROL 0207       /* B'10000111' */
  144 #define RR_CONTROL   01         /* B'00000001' */
  145 #define RNR_CONTROL  05         /* B'00000101' */
  146 #define REJ_CONTROL  011        /* B'00001001' */
  147 
  148 #define POLLOFF  0
  149 #define POLLON   1
  150 
  151 /* Define Link State constants. */
  152 
  153 #define INIT            0
  154 #define DM_SENT         1
  155 #define SABM_SENT       2
  156 #define ABM             3
  157 #define WAIT_SABM       4
  158 #define WAIT_UA         5
  159 #define DISC_SENT       6
  160 #define DISCONNECTED    7
  161 #define MAXSTATE        8
  162 
  163 /* The following constants are used in a switch statement to process
  164    frames read from the communications line. */
  165 
  166 #define SABM     0 * MAXSTATE
  167 #define DM       1 * MAXSTATE
  168 #define DISC     2 * MAXSTATE
  169 #define UA       3 * MAXSTATE
  170 #define FRMR     4 * MAXSTATE
  171 #define RR       5 * MAXSTATE
  172 #define RNR      6 * MAXSTATE
  173 #define REJ      7 * MAXSTATE
  174 #define IFRAME   8 * MAXSTATE
  175 #define ILLEGAL  9 * MAXSTATE
  176 
  177 #define T1      (3 * PR_SLOWHZ)         /*  IFRAME TIMEOUT - 3 seconds */
  178 #define T3      (T1 / 2)                /*  RR generate timeout - 1.5 seconds */
  179 #define N2      10
  180 #define MODULUS 8
  181 #define MAX_WINDOW_SIZE 7
  182 
  183 #define Z  0
  184 #define Y  1
  185 #define X  2
  186 #define W  3
  187 #define A  4
  188 
  189 #define TX 0
  190 #define RX 1

Cache object: 12789a1bd5144e6efdcd958b6f11b106


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.