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_var.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_var.h,v 1.18 2005/02/26 22:45:10 perry Exp $        */
    2 
    3 /*
    4  * Copyright (c) 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 the
    8  * Laboratory for Computation Vision and the Computer Science Department
    9  * of the University of British Columbia and the Computer Science
   10  * Department (IV) of the University of Erlangen-Nuremberg, Germany.
   11  *
   12  * Redistribution and use in source and binary forms, with or without
   13  * modification, are permitted provided that the following conditions
   14  * are met:
   15  * 1. Redistributions of source code must retain the above copyright
   16  *    notice, this list of conditions and the following disclaimer.
   17  * 2. Redistributions in binary form must reproduce the above copyright
   18  *    notice, this list of conditions and the following disclaimer in the
   19  *    documentation and/or other materials provided with the distribution.
   20  * 3. Neither the name of the University nor the names of its contributors
   21  *    may be used to endorse or promote products derived from this software
   22  *    without specific prior written permission.
   23  *
   24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   34  * SUCH DAMAGE.
   35  *
   36  *      @(#)pk_var.h    8.1 (Berkeley) 6/10/93
   37  */
   38 
   39 /*
   40  * Copyright (c) 1985 Computing Centre, University of British Columbia.
   41  * Copyright (c) 1990, 1991, 1992 Computer Science Department IV,
   42  *              University of Erlangen-Nuremberg, Germany.
   43  *
   44  * This code is derived from software contributed to Berkeley by the
   45  * Laboratory for Computation Vision and the Computer Science Department
   46  * of the University of British Columbia and the Computer Science
   47  * Department (IV) of the University of Erlangen-Nuremberg, Germany.
   48  *
   49  * Redistribution and use in source and binary forms, with or without
   50  * modification, are permitted provided that the following conditions
   51  * are met:
   52  * 1. Redistributions of source code must retain the above copyright
   53  *    notice, this list of conditions and the following disclaimer.
   54  * 2. Redistributions in binary form must reproduce the above copyright
   55  *    notice, this list of conditions and the following disclaimer in the
   56  *    documentation and/or other materials provided with the distribution.
   57  * 3. All advertising materials mentioning features or use of this software
   58  *    must display the following acknowledgement:
   59  *      This product includes software developed by the University of
   60  *      California, Berkeley and its contributors.
   61  * 4. Neither the name of the University nor the names of its contributors
   62  *    may be used to endorse or promote products derived from this software
   63  *    without specific prior written permission.
   64  *
   65  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   66  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   67  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   68  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   69  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   70  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   71  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   72  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   73  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   74  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   75  * SUCH DAMAGE.
   76  *
   77  *      @(#)pk_var.h    8.1 (Berkeley) 6/10/93
   78  */
   79 
   80 /*
   81  *
   82  *  X.25 Logical Channel Descriptor
   83  *
   84  */
   85 
   86 #if defined(_KERNEL_OPT)
   87 # include "opt_ccitt.h"
   88 #endif
   89 
   90  struct pklcd {
   91         struct  pklcd_q {
   92                 struct  pklcd_q *q_forw;        /* debugging chain */
   93                 struct  pklcd_q *q_back;        /* debugging chain */
   94         } lcd_q;
   95         int     (*lcd_upper)            /* switch to socket vs datagram vs ...*/
   96                         __P((struct mbuf *, void *));
   97         caddr_t lcd_upnext;             /* reference for lcd_upper() */
   98         void    (*lcd_send)             /* if X.25 front end, direct connect */
   99                         __P((struct pklcd *));
  100         caddr_t lcd_downnext;           /* reference for lcd_send() */
  101         short   lcd_lcn;                /* Logical channel number */
  102         short   lcd_state;              /* Logical Channel state */
  103         short   lcd_timer;              /* Various timer values */
  104         short   lcd_dg_timer;           /* to reclaim idle datagram circuits */
  105         bool    lcd_intrconf_pending;   /* Interrupt confirmation pending */
  106         octet   lcd_intrdata;           /* Octet of incoming intr data */
  107         char    lcd_retry;              /* Timer retry count */
  108         char    lcd_rsn;                /* Seq no of last received packet */
  109         char    lcd_ssn;                /* Seq no of next packet to send */
  110         char    lcd_output_window;      /* Output flow control window */
  111         char    lcd_input_window;       /* Input flow control window */
  112         char    lcd_last_transmitted_pr;/* Last Pr value transmitted */
  113         bool    lcd_rnr_condition;      /* Remote in busy condition */
  114         bool    lcd_window_condition;   /* Output window size exceeded */
  115         bool    lcd_reset_condition;    /* True, if waiting reset confirm */
  116         bool    lcd_rxrnr_condition;    /* True, if we have sent rnr */
  117         char    lcd_packetsize;         /* Maximum packet size */
  118         char    lcd_windowsize;         /* Window size - both directions */
  119         octet   lcd_closed_user_group;  /* Closed user group specification */
  120         char    lcd_flags;              /* copy of sockaddr_x25 op_flags */
  121         struct  mbuf *lcd_facilities;   /* user supplied facilities for cr */
  122         struct  mbuf *lcd_template;     /* Address of response packet */
  123         struct  socket *lcd_so;         /* Socket addr for connection */
  124         struct  sockaddr_x25 *lcd_craddr;/* Calling address pointer */
  125         struct  sockaddr_x25 *lcd_ceaddr;/* Called address pointer */
  126         time_t  lcd_stime;              /* time circuit established */
  127         long    lcd_txcnt;              /* Data packet transmit count */
  128         long    lcd_rxcnt;              /* Data packet receive count */
  129         short   lcd_intrcnt;            /* Interrupt packet transmit count */
  130         TAILQ_ENTRY(pklcd) lcd_listen;  /* Next lcd on listen queue */
  131         struct  pkcb *lcd_pkp;          /* Network this lcd is attached to */
  132         struct  mbuf *lcd_cps;          /* Complete Packet Sequence reassembly*/
  133         long    lcd_cpsmax;             /* Max length for CPS */
  134         struct  sockaddr_x25 lcd_faddr; /* Remote Address (Calling) */
  135         struct  sockaddr_x25 lcd_laddr; /* Local Address (Called) */
  136         struct  sockbuf lcd_sb;         /* alternate for datagram service */
  137 };
  138 
  139 /*
  140  * Per network information, allocated dynamically
  141  * when a new network is configured.
  142  */
  143 
  144 struct  pkcb {
  145         struct pkcb_q {
  146                 struct pkcb_q *q_forw;
  147                 struct pkcb_q *q_backw;
  148         } pk_q;
  149         short   pk_state;               /* packet level status */
  150         u_short pk_maxlcn;              /* local copy of xc_maxlcn */
  151         int     (*pk_lloutput)          /* link level output procedure */
  152                         __P((struct mbuf *, ...));
  153         void    *(*pk_llctlinput)       /* link level ctloutput procedure */
  154                         __P((int, struct sockaddr *, void *));
  155         caddr_t pk_llnext;              /* handle for next level down */
  156         struct  x25config *pk_xcp;      /* network specific configuration */
  157         struct  x25_ifaddr *pk_ia;      /* backpointer to ifaddr */
  158         struct  pklcd **pk_chan;        /* actual size == xc_maxlcn+1 */
  159         short   pk_dxerole;             /* DXE role of PLE over LLC2 */
  160         short   pk_restartcolls;        /* counting RESTART collisions til resolved */
  161         struct  rtentry *pk_rt;         /* back pointer to route */
  162         struct  rtentry *pk_llrt;       /* pointer to reverse mapping */
  163         u_short pk_refcount;            /* ref count */
  164 };
  165 
  166 #define FOR_ALL_PKCBS(p) for((p) = (struct pkcb *)(pkcb_q.q_forw); \
  167                              (pkcb_q.q_forw != &pkcb_q) && ((struct pkcb_q *)(p) != &pkcb_q); \
  168                              (p) = (struct pkcb *)((p) -> pk_q.q_forw))
  169 
  170 #define PQEMPTY         (pkcb_q.q_forw == &pkcb_q)
  171 
  172 /*
  173  *      Interface address, x25 version. Exactly one of these structures is
  174  *      allocated for each interface with an x25 address.
  175  *
  176  *      The ifaddr structure conatins the protocol-independent part
  177  *      of the structure, and is assumed to be first.
  178  */
  179 struct x25_ifaddr {
  180         struct  ifaddr ia_ifa;          /* protocol-independent info */
  181 #define ia_ifp  ia_ifa.ifa_ifp
  182 #define ia_flags ia_ifa.ifa_flags
  183         struct  x25config ia_xc;        /* network specific configuration */
  184         struct  pkcb *ia_pkcb;
  185 #define ia_maxlcn ia_xc.xc_maxlcn
  186         int     (*ia_start)             /* connect, confirm method */
  187                         __P((struct pklcd *));
  188         struct  sockaddr_x25 ia_dstaddr; /* reserve space for route dst */
  189 };
  190 
  191 /*
  192  * ``Link-Level'' extension to Routing Entry for upper level
  193  * packet switching via X.25 virtual circuits.
  194  */
  195 struct llinfo_x25 {
  196         LIST_ENTRY(llinfo_x25) lx_list;
  197         struct  rtentry *lx_rt;         /* back pointer to route */
  198         struct  pklcd *lx_lcd;          /* local connection block */
  199         struct  x25_ifaddr *lx_ia;      /* may not be same as rt_ifa */
  200         int     lx_state;               /* can't trust lcd->lcd_state */
  201         int     lx_flags;
  202         int     lx_timer;               /* for idle timeout */
  203         int     lx_family;              /* for dispatch */
  204 };
  205 
  206 /* States for lx_state */
  207 #define LXS_NEWBORN             0
  208 #define LXS_RESOLVING           1
  209 #define LXS_FREE                2
  210 #define LXS_CONNECTING          3
  211 #define LXS_CONNECTED           4
  212 #define LXS_DISCONNECTING       5
  213 #define LXS_LISTENING           6
  214 
  215 /* flags */
  216 #define LXF_VALID       0x1             /* Circuit is live, etc. */
  217 #define LXF_RTHELD      0x2             /* this lcb references rtentry */
  218 #define LXF_LISTEN      0x4             /* accepting incoming calls */
  219 
  220 /*
  221  * Definitions for accessing bitfields/bitslices inside X.25 structs
  222  */
  223 
  224 
  225 struct x25bitslice {
  226         unsigned int bs_mask;
  227         unsigned int bs_shift;
  228 };
  229 
  230 #define calling_addrlen 0
  231 #define called_addrlen  1
  232 #define q_bit           2
  233 #define d_bit           3
  234 #define fmt_identifier  4
  235 #define lc_group_number 1
  236 #define p_r             5
  237 #define m_bit           6
  238 #define p_s             7
  239 #define zilch           8
  240 
  241 #define X25GBITS(Arg, Index)    (((Arg) & x25_bitslice[(Index)].bs_mask) >> x25_bitslice[(Index)].bs_shift)
  242 #define X25SBITS(Arg, Index, Val)       (Arg) |= (((Val) << x25_bitslice[(Index)].bs_shift) & x25_bitslice[(Index)].bs_mask)
  243 #define X25CSBITS(Arg, Index, Val)      (Arg) = (((Val) << x25_bitslice[(Index)].bs_shift) & x25_bitslice[(Index)].bs_mask)
  244 
  245 extern const struct x25bitslice x25_bitslice[];
  246 
  247 
  248 #define ISOFIFTTYPE(i,t) ((i)->if_type == (t))
  249 #define ISISO8802(i) ((ISOFIFTTYPE(i, IFT_ETHER) || \
  250                        ISOFIFTTYPE(i, IFT_ISO88023) || \
  251                        ISOFIFTTYPE(i, IFT_ISO88024) || \
  252                        ISOFIFTTYPE(i, IFT_ISO88025) || \
  253                        ISOFIFTTYPE(i, IFT_ISO88026) || \
  254                        ISOFIFTTYPE(i, IFT_P10) || \
  255                        ISOFIFTTYPE(i, IFT_P80) || \
  256                        ISOFIFTTYPE(i, IFT_FDDI)))
  257 
  258 /*
  259  * miscellenous debugging info
  260  */
  261 struct mbuf_cache {
  262         int     mbc_size;
  263         int     mbc_num;
  264         int     mbc_oldsize;
  265         struct  mbuf **mbc_cache;
  266 };
  267 
  268 #if defined(_KERNEL) && defined(CCITT)
  269 #include <sys/queue.h>
  270 
  271 extern struct pkcb_q pkcb_q;
  272 TAILQ_HEAD(pklcdhead, pklcd);
  273 extern struct pklcdhead pk_listenhead;
  274 extern struct mbuf_cache pk_input_cache;
  275 extern struct mbuf_cache pk_output_cache;
  276 
  277 extern char     *pk_name[], *pk_state[];
  278 extern int      pk_t20, pk_t21, pk_t22, pk_t23;
  279 #endif

Cache object: ed2445529f58c349e9e02b28aa3f2c36


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