Initial import from FreeBSD RELENG_4:
[dragonfly.git] / sys / netproto / atm / uni / sscop_misc.h
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: src/sys/netatm/uni/sscop_misc.h,v 1.2 1999/08/28 00:48:59 peter Exp $
27  *
28  */
29
30 /*
31  * ATM Forum UNI Support
32  * ---------------------
33  *
34  * SSCOP miscellaneous definitions
35  *
36  */
37
38 #ifndef _UNI_SSCOP_MISC_H
39 #define _UNI_SSCOP_MISC_H
40
41 /*
42  * SSCOP command definitions
43  */
44 #define SSCOP_CMD_MIN   SSCOP_INIT      /* Minimum SSCOP CMD value */
45 #define SSCOP_CMD_MAX   SSCOP_RETRIEVECMP_IND   /* Maximum SSCOP CMD value */
46 #define SSCOP_CMD_SIZE  36              /* Size of command lookup table */
47
48
49 /*
50  * Management Errors
51  */
52 #define MAA_ERROR_MIN   'A'
53 #define MAA_ERROR_MAX   'X'
54 #define MAA_ERROR_INVAL (MAA_ERROR_MAX + 1)
55 #define MAA_ERROR_COUNT (MAA_ERROR_MAX - MAA_ERROR_MIN + 2)
56
57
58 /*
59  * SSCOP Sequence Numbers
60  *
61  * SSCOP sequence numbers are 24 bit integers using modulo arithmetic.
62  * The macros below must be used to modify and compare such numbers.
63  * Comparison of sequence numbers is always relative to some base number (b).
64  */
65 typedef u_int     sscop_seq;
66
67 #define SEQ_MOD         0xffffff
68 #define SEQ_VAL(v)      ((v) & SEQ_MOD)
69 #define SEQ_SET(s,v)    ((s) = SEQ_VAL(v))
70 #define SEQ_ADD(s,v)    (SEQ_VAL((s) + (v)))
71 #define SEQ_SUB(s,v)    (SEQ_VAL((s) - (v)))
72 #define SEQ_INCR(s,v)   ((s) = SEQ_VAL((s) + (v)))
73 #define SEQ_DECR(s,v)   ((s) = SEQ_VAL((s) - (v)))
74 #define SEQ_EQ(x,y)     (SEQ_VAL(x) == SEQ_VAL(y))
75 #define SEQ_NEQ(x,y)    (SEQ_VAL(x) != SEQ_VAL(y))
76 #define SEQ_LT(x,y,b)   (SEQ_VAL((x) - (b)) < SEQ_VAL((y) - (b)))
77 #define SEQ_LEQ(x,y,b)  (SEQ_VAL((x) - (b)) <= SEQ_VAL((y) - (b)))
78 #define SEQ_GT(x,y,b)   (SEQ_VAL((x) - (b)) > SEQ_VAL((y) - (b)))
79 #define SEQ_GEQ(x,y,b)  (SEQ_VAL((x) - (b)) >= SEQ_VAL((y) - (b)))
80
81
82 /*
83  * SSCOP Timers
84  *
85  * All of the SSCOP timer fields are maintained in terms of clock ticks.
86  * The timers tick 2 times per second.
87  */
88 #define SSCOP_HZ        2               /* SSCOP ticks per second */
89
90 #define SSCOP_T_NUM     4               /* Number of timers per connection */
91
92 #define SSCOP_T_POLL    0               /* Timer_POLL / Timer_KEEP-ALIVE */
93 #define SSCOP_T_NORESP  1               /* Timer_NO-RESPONSE */
94 #define SSCOP_T_CC      2               /* Timer_CC */
95 #define SSCOP_T_IDLE    3               /* Timer_IDLE */
96
97 #endif  /* _UNI_SSCOP_MISC_H */