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/pk.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: pk.h,v 1.10 2003/08/07 16:33:03 agc Exp $      */
    2 
    3 /*
    4  * Copyright (c) 1990, 1992, 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  *      @(#)pk.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  *      @(#)pk.h        8.1 (Berkeley) 6/10/93
   74  */
   75 
   76 #ifndef _NETCCITT_PK_H_
   77 #define _NETCCITT_PK_H_
   78 
   79 /*
   80  *
   81  *  X.25 Packet Level Definitions:
   82  *
   83  */
   84 
   85 /* Packet type identifier field definitions. */
   86 
   87 #define X25_CALL                         11
   88 #define X25_CALL_ACCEPTED                15   
   89 #define X25_CLEAR                        19
   90 #define X25_CLEAR_CONFIRM                23  
   91 #define X25_DATA                          0   
   92 #define X25_INTERRUPT                    35   
   93 #define X25_INTERRUPT_CONFIRM            39   
   94 
   95 #define X25_RR                            1   
   96 #define X25_RNR                           5   
   97 #define X25_REJECT                        9
   98 #define X25_RESET                        27 
   99 #define X25_RESET_CONFIRM                31   
  100 #define X25_DIAGNOSTIC                  241
  101 
  102 #define X25_RESTART                     251     
  103 #define X25_RESTART_CONFIRM             255 
  104 
  105 /* Restart cause field definitions. */
  106 
  107 #define X25_RESTART_DTE_ORIGINATED        0
  108 #define X25_RESTART_LOCAL_PROCEDURE_ERROR 1
  109 #define X25_RESTART_NETWORK_CONGESTION    3
  110 #define X25_RESTART_NETWORK_OPERATIONAL   7
  111 #define X25_RESTART_DTE_ORIGINATED2       128
  112 
  113 
  114 /* Miscellaneous definitions. */
  115 
  116 #define DATA_PACKET_DESIGNATOR          0x01
  117 #define RR_OR_RNR_PACKET_DESIGNATOR     0x02
  118 #define RR_PACKET_DESIGNATOR            0x04
  119 
  120 #define DEFAULT_WINDOW_SIZE             2
  121 #define MODULUS                         8
  122 
  123 #define ADDRLN                          1
  124 #define MAXADDRLN                       15
  125 #define FACILITIESLN                    1
  126 #define MAXFACILITIESLN                 10
  127 #define MAXUSERDATA                     16
  128 #define MAXCALLINFOLN                   1+15+1+10+16
  129 
  130 #define PACKET_OK                       0
  131 #define IGNORE_PACKET                   1
  132 #define ERROR_PACKET                    2
  133 
  134 #ifndef CCITT_TYPES_DEFINED
  135 #define CCITT_TYPES_DEFINED
  136 #define FALSE   0
  137 #define TRUE    1
  138 typedef char    bool;
  139 typedef u_char octet;
  140 #endif
  141 
  142 /*
  143  *  X.25 Packet format definitions
  144  *  This will eventually have to be rewritten without reference
  145  *  to bit fields, to be ansi C compliant and allignment safe.
  146  */
  147 
  148 
  149 struct x25_calladdr {
  150         octet addrlens;
  151         octet address_field[MAXADDRLN];
  152 };
  153 
  154 struct x25_packet {
  155         octet bits;
  156         octet logical_channel_number;
  157         octet packet_type;
  158         octet packet_data;
  159 };
  160 #define packet_cause packet_data
  161 
  162 struct data_packet {
  163         octet bits;
  164 };
  165 
  166 #define FACILITIES_REVERSE_CHARGE       0x1
  167 #define FACILITIES_THROUGHPUT           0x2
  168 #define FACILITIES_PACKETSIZE           0x42
  169 #define FACILITIES_WINDOWSIZE           0x43
  170 
  171 #define PKHEADERLN      3
  172 
  173 #define DP(xp)          (((struct data_packet *)&(xp) -> packet_type) -> bits)
  174 #define PS(xp)           X25GBITS(DP(xp), p_s)
  175 #define PR(xp)           X25GBITS(DP(xp), p_r)
  176 #define MBIT(xp)         X25GBITS(DP(xp), m_bit)
  177 #define SPR(xp, v)       X25SBITS(DP(xp), p_r, (v))
  178 #define SPS(xp, v)       X25SBITS(DP(xp), p_s, (v))
  179 #define SMBIT(xp, v)     X25SBITS(DP(xp), m_bit, (v))
  180 
  181 #define LCN(xp)         (xp -> logical_channel_number + \
  182         (X25GBITS(xp -> bits, lc_group_number) ? (X25GBITS(xp -> bits, lc_group_number) << 8) : 0))
  183 #define SET_LCN(xp, lcn) ((xp -> logical_channel_number = lcn), \
  184         (X25SBITS(xp -> bits, lc_group_number, lcn > 255 ? lcn >> 8 : 0)))
  185 
  186 /* Define X.25 packet level states. */
  187 
  188 /* Call setup and clearing substates.  */
  189 
  190 #define LISTEN           0
  191 #define READY            1
  192 #define RECEIVED_CALL    2
  193 #define SENT_CALL        3
  194 #define DATA_TRANSFER    4
  195 #define RECEIVED_CLEAR   5
  196 #define SENT_CLEAR       6
  197 
  198 /* DTE states. */
  199 
  200 #define DTE_WAITING             7
  201 #define DTE_RECEIVED_RESTART    8
  202 #define DTE_SENT_RESTART        9
  203 #define DTE_READY               0
  204 
  205 /* Cleaning out ... */
  206 
  207 #define LCN_ZOMBIE              10
  208 
  209 #define MAXSTATES               11
  210 
  211 /*
  212  *  The following definitions are used in a switch statement after
  213  *  determining the packet type.  These values are returned by the
  214  *  pk_decode procedure. 
  215  */
  216 
  217 #define PK_CALL                 (0 * MAXSTATES)
  218 #define PK_CALL_ACCEPTED        (1 * MAXSTATES)
  219 #define PK_CLEAR                (2 * MAXSTATES)
  220 #define PK_CLEAR_CONF           (3 * MAXSTATES)
  221 #define PK_DATA                 (4 * MAXSTATES)
  222 #define PK_INTERRUPT            (5 * MAXSTATES)
  223 #define PK_INTERRUPT_CONF       (6 * MAXSTATES)
  224 #define PK_RR                   (7 * MAXSTATES)
  225 #define PK_RNR                  (8 * MAXSTATES)
  226 #define PK_RESET                (9 * MAXSTATES)
  227 #define PK_RESET_CONF           (10 * MAXSTATES)
  228 #define PK_RESTART              (11 * MAXSTATES)
  229 #define PK_RESTART_CONF         (12 * MAXSTATES)
  230 #define PK_REJECT               (13 * MAXSTATES)
  231 #define PK_DIAG_TYPE            (14 * MAXSTATES)
  232 #define PK_INVALID_PACKET       (15 * MAXSTATES)
  233 #define PK_DELETE_PACKET        (PK_INVALID_PACKET)
  234 
  235 /*
  236  * The following definitions are used by the restart procedures
  237  * for noting wether the PLE is supposed to behave as DTE or DCE
  238  * (essentially necessary for operation over LLC2)
  239  */
  240 #define DTE_DXERESOLVING        0x0001
  241 #define DTE_PLAYDTE             0x0002
  242 #define DTE_PLAYDCE             0x0004
  243 #define DTE_CONNECTPENDING      0x0010
  244 #define DTE_PRETENDDTE          0x0020
  245 
  246 #define MAXRESTARTCOLLISIONS    10
  247 
  248 #endif /* _NETCCITT_PK_H_ */

Cache object: 8d95071581df12e7cff9f7e825ddcb80


[ 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.