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/netatm/atm_sys.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 /*-
    2  *
    3  * ===================================
    4  * HARP  |  Host ATM Research Platform
    5  * ===================================
    6  *
    7  *
    8  * This Host ATM Research Platform ("HARP") file (the "Software") is
    9  * made available by Network Computing Services, Inc. ("NetworkCS")
   10  * "AS IS".  NetworkCS does not provide maintenance, improvements or
   11  * support of any kind.
   12  *
   13  * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
   14  * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
   15  * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
   16  * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
   17  * In no event shall NetworkCS be responsible for any damages, including
   18  * but not limited to consequential damages, arising from or relating to
   19  * any use of the Software or related support.
   20  *
   21  * Copyright 1994-1998 Network Computing Services, Inc.
   22  *
   23  * Copies of this Software may be made, however, the above copyright
   24  * notice must be reproduced on all copies.
   25  *
   26  *      @(#) $FreeBSD: releng/6.1/sys/netatm/atm_sys.h 139823 2005-01-07 01:45:51Z imp $
   27  *
   28  */
   29 
   30 /*
   31  * Core ATM Services
   32  * -----------------
   33  *
   34  * General system definitions
   35  *
   36  */
   37 
   38 #ifndef _NETATM_ATM_SYS_H
   39 #define _NETATM_ATM_SYS_H
   40 
   41 /*
   42  * Software Version
   43  */
   44 #define ATM_VERSION     0x00030000      /* Version 3.0 */
   45 #define ATM_VERS_MAJ(v) ((v) >> 16)
   46 #define ATM_VERS_MIN(v) ((v) & 0xffff)
   47 
   48 
   49 /*
   50  * Misc system defines
   51  */
   52 #define ATM_CALLQ_MAX   100             /* Maximum length of call queue */
   53 #define ATM_INTRQ_MAX   1000            /* Maximum length of interrupt queue */
   54 
   55 
   56 /*
   57  * ATM address manipulation macros
   58  */
   59 #define ATM_ADDR_EQUAL(a1, a2)                                          \
   60         (((a1)->address_format == (a2)->address_format) &&              \
   61          ((a1)->address_length == (a2)->address_length) &&              \
   62          (bcmp((caddr_t)(a1)->address, (caddr_t)(a2)->address,          \
   63                 (a1)->address_length) == 0))
   64 
   65 #define ATM_ADDR_SEL_EQUAL(a1, s1, a2)                                  \
   66         (((a1)->address_format == (a2)->address_format) &&              \
   67          ((a1)->address_length == (a2)->address_length) &&              \
   68          (((((a1)->address_format == T_ATM_ENDSYS_ADDR) ||              \
   69             ((a1)->address_format == T_ATM_NSAP_ADDR)) &&               \
   70            (bcmp((caddr_t)(a1)->address, (caddr_t)(a2)->address,        \
   71                 (a1)->address_length - 1) == 0) &&                      \
   72            ((s1) == ((struct atm_addr_nsap *)(a2)->address)->aan_sel)) || \
   73           (((a1)->address_format != T_ATM_ENDSYS_ADDR) &&               \
   74            ((a1)->address_format != T_ATM_NSAP_ADDR) &&                 \
   75            (bcmp((caddr_t)(a1)->address, (caddr_t)(a2)->address,        \
   76                 (a1)->address_length) == 0))))
   77 
   78 #define ATM_ADDR_COPY(a1, a2)                                           \
   79 {                                                                       \
   80         (a2)->address_format = (a1)->address_format;                    \
   81         (a2)->address_length = (a1)->address_length;                    \
   82         bcopy((caddr_t)(a1)->address, (caddr_t)(a2)->address,           \
   83                 (a1)->address_length);                                  \
   84 }
   85 
   86 #define ATM_ADDR_SEL_COPY(a1, s1, a2)                                   \
   87 {                                                                       \
   88         (a2)->address_format = (a1)->address_format;                    \
   89         (a2)->address_length = (a1)->address_length;                    \
   90         if (((a1)->address_format == T_ATM_ENDSYS_ADDR) ||              \
   91             ((a1)->address_format == T_ATM_NSAP_ADDR)) {                \
   92                 bcopy((caddr_t)(a1)->address, (caddr_t)(a2)->address,   \
   93                         (a1)->address_length - 1);                      \
   94                 ((struct atm_addr_nsap *)(a2)->address)->aan_sel = (s1);\
   95         } else {                                                        \
   96                 bcopy((caddr_t)(a1)->address, (caddr_t)(a2)->address,   \
   97                         (a1)->address_length);                          \
   98         }                                                               \
   99 }
  100 
  101 
  102 /*
  103  * ATM Cell Header definitions
  104  */
  105 
  106 /*
  107  * These macros assume that the cell header (minus the HEC)
  108  * is contained in the least-significant 32-bits of a word
  109  */
  110 #define ATM_HDR_SET_VPI(vpi)    (((vpi) & 0xff) << 20)
  111 #define ATM_HDR_SET_VCI(vci)    (((vci) & 0xffff) << 4)
  112 #define ATM_HDR_SET_PT(pt)      (((pt) & 0x7) << 1)
  113 #define ATM_HDR_SET_CLP(clp)    ((clp) & 0x1)
  114 #define ATM_HDR_SET(vpi,vci,pt,clp)     (ATM_HDR_SET_VPI(vpi) | \
  115                                         ATM_HDR_SET_VCI(vci) | \
  116                                         ATM_HDR_SET_PT(pt) | \
  117                                         ATM_HDR_SET_CLP(clp))
  118 #define ATM_HDR_GET_VPI(hdr)    (((hdr) >> 20) & 0xff)
  119 #define ATM_HDR_GET_VCI(hdr)    (((hdr) >> 4) & 0xffff)
  120 #define ATM_HDR_GET_PT(hdr)     (((hdr) >> 1) & 0x7)
  121 #define ATM_HDR_GET_CLP(hdr)    ((hdr) & 0x1)
  122 
  123 /*
  124  * Payload Type Identifier (3 bits)
  125  */
  126 #define ATM_PT_USER_SDU0        0x0     /* User, no congestion, sdu type 0 */
  127 #define ATM_PT_USER_SDU1        0x1     /* User, no congestion, sdu type 1 */
  128 #define ATM_PT_USER_CONG_SDU0   0x2     /* User, congestion, sdu type 0 */
  129 #define ATM_PT_USER_CONG_SDU1   0x3     /* User, congestion, sdu type 1 */
  130 #define ATM_PT_NONUSER          0x4     /* User/non-user differentiator */
  131 #define ATM_PT_OAMF5_SEG        0x4     /* OAM F5 segment flow */
  132 #define ATM_PT_OAMF5_E2E        0x5     /* OAM F5 end-to-end flow */
  133 
  134 
  135 /*
  136  * AAL (ATM Adaptation Layer) codes
  137  */
  138 typedef u_char  Aal_t;
  139 #define ATM_AAL0        0               /* AAL0 - Cell service */
  140 #define ATM_AAL1        1               /* AAL1 */
  141 #define ATM_AAL2        2               /* AAL2 */
  142 #define ATM_AAL3_4      3               /* AAL3/4 */
  143 #define ATM_AAL5        5               /* AAL5 */
  144 
  145 
  146 /*
  147  * VCC Encapsulation codes
  148  */
  149 typedef u_char  Encaps_t;
  150 #define ATM_ENC_NULL    1               /* Null encapsulation */
  151 #define ATM_ENC_LLC     2               /* LLC encapsulation */
  152 
  153 
  154 #ifdef _KERNEL
  155 /*
  156  * ATM timer control block.  Used to schedule a timeout via atm_timeout().
  157  * This control block will typically be embedded in a processing-specific
  158  * control block.
  159  */
  160 struct atm_time {
  161         u_short         ti_ticks;       /* Delta of ticks until timeout */
  162         u_char          ti_flag;        /* Timer flag bits (see below) */
  163         void            (*ti_func)      /* Call at timeout expiration */
  164                                 (struct atm_time *);
  165         struct atm_time *ti_next;       /* Next on queue */
  166 };
  167 
  168 /*
  169  * Timer Flags
  170  */
  171 #define TIF_QUEUED      0x01            /* Control block on timer queue */
  172 
  173 #define ATM_HZ          2               /* Time ticks per second */
  174 
  175 /*
  176  * Debugging
  177  */
  178 #ifdef DIAGNOSTIC
  179 #define ATM_TIME                                                        \
  180         struct timeval now, delta;                                      \
  181         KT_TIME(now);                                                   \
  182         delta.tv_sec = now.tv_sec - atm_debugtime.tv_sec;               \
  183         delta.tv_usec = now.tv_usec - atm_debugtime.tv_usec;            \
  184         atm_debugtime = now;                                            \
  185         if (delta.tv_usec < 0) {                                        \
  186                 delta.tv_sec--;                                         \
  187                 delta.tv_usec += 1000000;                               \
  188         }                                                               \
  189         printf("%3ld.%6ld: ", delta.tv_sec, delta.tv_usec);
  190 
  191 #define ATM_DEBUG0(f)           if (atm_debug) {ATM_TIME; printf(f);}
  192 #define ATM_DEBUGN0(f)          if (atm_debug) {printf(f);}
  193 #define ATM_DEBUG1(f,a1)        if (atm_debug) {ATM_TIME; printf(f, a1);}
  194 #define ATM_DEBUGN1(f,a1)       if (atm_debug) {printf(f, a1);}
  195 #define ATM_DEBUG2(f,a1,a2)     if (atm_debug) {ATM_TIME; printf(f, a1, a2);}
  196 #define ATM_DEBUGN2(f,a1,a2)    if (atm_debug) {printf(f, a1, a2);}
  197 #define ATM_DEBUG3(f,a1,a2,a3)  if (atm_debug) {ATM_TIME; printf(f, a1, a2, a3);}
  198 #define ATM_DEBUGN3(f,a1,a2,a3) if (atm_debug) {printf(f, a1, a2, a3);}
  199 #define ATM_DEBUG4(f,a1,a2,a3,a4)       if (atm_debug) {ATM_TIME; printf(f, a1, a2, a3, a4);}
  200 #define ATM_DEBUGN4(f,a1,a2,a3,a4)      if (atm_debug) {printf(f, a1, a2, a3, a4);}
  201 #define ATM_DEBUG5(f,a1,a2,a3,a4,a5)    if (atm_debug) {ATM_TIME; printf(f, a1, a2, a3, a4, a5);}
  202 #define ATM_DEBUGN5(f,a1,a2,a3,a4,a5)   if (atm_debug) {printf(f, a1, a2, a3, a4, a5);}
  203 #else
  204 #define ATM_DEBUG0(f)
  205 #define ATM_DEBUGN0(f)
  206 #define ATM_DEBUG1(f,a1)
  207 #define ATM_DEBUGN1(f,a1)
  208 #define ATM_DEBUG2(f,a1,a2)
  209 #define ATM_DEBUGN2(f,a1,a2)
  210 #define ATM_DEBUG3(f,a1,a2,a3)
  211 #define ATM_DEBUGN3(f,a1,a2,a3)
  212 #define ATM_DEBUG4(f,a1,a2,a3,a4)
  213 #define ATM_DEBUGN4(f,a1,a2,a3,a4)
  214 #define ATM_DEBUG5(f,a1,a2,a3,a4,a5)
  215 #define ATM_DEBUGN5(f,a1,a2,a3,a4,a5)
  216 #endif
  217 
  218 #endif  /* _KERNEL */
  219 
  220 #endif  /* _NETATM_ATM_SYS_H */

Cache object: b610144c3807ed147bd5dab52fc410ae


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