1 /*
2  * Copyright (c) 1996-2003
3  *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4  * 	All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  * Author: Hartmut Brandt <[email protected]>
28  *
29  * $Begemot: libunimsg/netnatm/saal/sscopdef.h,v 1.4 2004/07/08 08:22:17 brandt Exp $
30  *
31  * Definitions of SSCOP constants and parameter blocks. This is seen by
32  * the outside world.
33  */
34 #ifndef _NETNATM_SAAL_SSCOPDEF_H_
35 #define _NETNATM_SAAL_SSCOPDEF_H_
36 
37 #include <sys/types.h>
38 #ifdef _KERNEL
39 #include <sys/stdint.h>
40 #else
41 #include <stdint.h>
42 #endif
43 
44 /*
45  * AA-interface signals
46  */
47 enum sscop_aasig {
48 	SSCOP_ESTABLISH_request,	/* <- UU, BR */
49 	SSCOP_ESTABLISH_indication,	/* -> UU */
50 	SSCOP_ESTABLISH_response,	/* <- UU, BR */
51 	SSCOP_ESTABLISH_confirm,	/* -> UU */
52 
53 	SSCOP_RELEASE_request,		/* <- UU */
54 	SSCOP_RELEASE_indication,	/* -> UU, SRC */
55 	SSCOP_RELEASE_confirm,		/* -> */
56 
57 	SSCOP_DATA_request,		/* <- MU */
58 	SSCOP_DATA_indication,		/* -> MU, SN */
59 
60 	SSCOP_UDATA_request,		/* <- MU */
61 	SSCOP_UDATA_indication,		/* -> MU */
62 
63 	SSCOP_RECOVER_indication,	/* -> */
64 	SSCOP_RECOVER_response,		/* <- */
65 
66 	SSCOP_RESYNC_request,		/* <- UU */
67 	SSCOP_RESYNC_indication,	/* -> UU */
68 	SSCOP_RESYNC_response,		/* <- */
69 	SSCOP_RESYNC_confirm,		/* -> */
70 
71 	SSCOP_RETRIEVE_request,		/* <- RN */
72 	SSCOP_RETRIEVE_indication,	/* -> MU */
73 	SSCOP_RETRIEVE_COMPL_indication,/* -> */
74 };
75 
76 enum sscop_maasig {
77 	SSCOP_MDATA_request,		/* <- MU */
78 	SSCOP_MDATA_indication,		/* -> MU */
79 	SSCOP_MERROR_indication,	/* -> CODE, CNT */
80 };
81 
82 /*
83  * Values for retrieval. Numbers in SSCOP are 24bit, so
84  * we can use the large values
85  */
86 enum {
87 	SSCOP_MAXSEQNO		= 0xffffff,
88 
89 	SSCOP_RETRIEVE_UNKNOWN	= SSCOP_MAXSEQNO + 1,
90 	SSCOP_RETRIEVE_TOTAL	= SSCOP_MAXSEQNO + 2,
91 };
92 
93 /*
94  * SSCOP states
95  */
96 enum sscop_state {
97 	SSCOP_IDLE,		/* initial state */
98 	SSCOP_OUT_PEND,		/* outgoing connection pending */
99 	SSCOP_IN_PEND,		/* incoming connection pending */
100 	SSCOP_OUT_DIS_PEND,	/* outgoing disconnect pending */
101 	SSCOP_OUT_RESYNC_PEND,	/* outgoing resynchronisation pending */
102 	SSCOP_IN_RESYNC_PEND,	/* incoming resynchronisation pending */
103 	SSCOP_OUT_REC_PEND,	/* outgoing recovery pending */
104 	SSCOP_REC_PEND,		/* recovery response pending */
105 	SSCOP_IN_REC_PEND,	/* incoming recovery pending */
106 	SSCOP_READY,		/* data transfer ready */
107 };
108 #define SSCOP_NSTATES 10
109 
110 struct sscop_param {
111 	uint32_t	timer_cc;	/* timer_cc in msec */
112 	uint32_t	timer_poll;	/* timer_poll im msec */
113 	uint32_t	timer_keep_alive;/* timer_keep_alive in msec */
114 	uint32_t	timer_no_response;/*timer_no_response in msec */
115 	uint32_t	timer_idle;	/* timer_idle in msec */
116 	uint32_t	maxk;		/* maximum user data in bytes */
117 	uint32_t	maxj;		/* maximum u-u info in bytes */
118 	uint32_t	maxcc;		/* max. retransmissions for control packets */
119 	uint32_t	maxpd;		/* max. vt(pd) before sending poll */
120 	uint32_t	maxstat;	/* max. number of elements in stat list */
121 	uint32_t	mr;		/* initial window */
122 	uint32_t	flags;		/* flags */
123 };
124 enum {
125 	SSCOP_ROBUST 	= 0x0001,	/* atmf/97-0216 robustness */
126 	SSCOP_POLLREX	= 0x0002,	/* send POLL after retransmit */
127 };
128 
129 enum {
130 	SSCOP_SET_TCC		= 0x0001,
131 	SSCOP_SET_TPOLL		= 0x0002,
132 	SSCOP_SET_TKA		= 0x0004,
133 	SSCOP_SET_TNR		= 0x0008,
134 	SSCOP_SET_TIDLE		= 0x0010,
135 	SSCOP_SET_MAXK		= 0x0020,
136 	SSCOP_SET_MAXJ		= 0x0040,
137 	SSCOP_SET_MAXCC		= 0x0080,
138 	SSCOP_SET_MAXPD		= 0x0100,
139 	SSCOP_SET_MAXSTAT	= 0x0200,
140 	SSCOP_SET_MR		= 0x0400,
141 	SSCOP_SET_ROBUST	= 0x0800,
142 	SSCOP_SET_POLLREX	= 0x1000,
143 
144 	SSCOP_SET_ALLMASK	= 0x1fff,
145 };
146 
147 enum {
148 	SSCOP_DBG_USIG	= 0x0001,
149 	SSCOP_DBG_TIMER	= 0x0002,
150 	SSCOP_DBG_BUG	= 0x0004,
151 	SSCOP_DBG_INSIG	= 0x0008,
152 	SSCOP_DBG_STATE	= 0x0010,
153 	SSCOP_DBG_PDU	= 0x0020,
154 	SSCOP_DBG_ERR	= 0x0040,
155 	SSCOP_DBG_EXEC	= 0x0080,
156 	SSCOP_DBG_FLOW	= 0x0100,
157 };
158 
159 #endif
160