3 * ===================================
4 * HARP | Host ATM Research Platform
5 * ===================================
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.
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.
21 * Copyright 1994-1998 Network Computing Services, Inc.
23 * Copies of this Software may be made, however, the above copyright
24 * notice must be reproduced on all copies.
26 * @(#) $FreeBSD: src/usr.sbin/atm/scspd/scsp_msg.h,v 1.2 1999/08/28 01:15:33 peter Exp $
27 * @(#) $DragonFly: src/usr.sbin/atm/scspd/scsp_msg.h,v 1.2 2003/06/17 04:29:52 dillon Exp $
32 * Server Cache Synchronization Protocol (SCSP) Support
33 * ----------------------------------------------------
35 * SCSP message formats
39 #ifndef _SCSP_SCSP_MSG_H
40 #define _SCSP_SCSP_MSG_H
46 #define ARP_ATMFORUM 19
47 #define ARP_TL_TMASK 0x40 /* Type mask */
48 #define ARP_TL_NSAPA 0x00 /* Type = ATM Forum NSAPA */
49 #define ARP_TL_E164 0x40 /* Type = E.164 */
50 #define ARP_TL_LMASK 0x3f /* Length mask */
63 #define SCSP_CSU_REQ_MSG 2
64 #define SCSP_CSU_REPLY_MSG 3
65 #define SCSP_CSUS_MSG 4
66 #define SCSP_HELLO_MSG 5
70 * SCSP Client Protocol IDs
72 #define SCSP_PROTO_ATMARP 1
73 #define SCSP_PROTO_NHRP 2
74 #define SCSP_PROTO_MARS 3
75 #define SCSP_PROTO_DHCP 4
76 #define SCSP_PROTO_LNNI 5
82 #define SCSP_EXT_END 0
83 #define SCSP_EXT_AUTH 1
84 #define SCSP_EXT_VENDOR 2
87 * Sequence number bounds
89 #define SCSP_CSA_SEQ_MIN 0x80000001
90 #define SCSP_CSA_SEQ_MAX 0x7FFFFFFF
94 * Sender, Receiver, or Originator ID lengths
96 #define SCSP_ATMARP_ID_LEN 4
97 #define SCSP_NHRP_ID_LEN 4
98 #define SCSP_MAX_ID_LEN 4
104 #define SCSP_ATMARP_KEY_LEN 4
105 #define SCSP_NHRP_KEY_LEN 4
106 #define SCSP_MAX_KEY_LEN 4
113 u_char sh_ver
; /* SCSP version */
114 u_char sh_type
; /* Message type */
115 u_short sh_len
; /* Message length */
116 u_short sh_checksum
; /* IP checksum over message */
117 u_short sh_ext_off
; /* Offset of first extension */
122 * Mandatory common part
125 u_short sm_pid
; /* Protocol ID */
126 u_short sm_sgid
; /* Server group ID */
127 u_short sm_fill_0
; /* Unused */
128 u_short sm_flags
; /* Flags--see below */
129 u_char sm_sid_len
; /* Sender ID length */
130 u_char sm_rid_len
; /* Receiver ID length */
131 u_short sm_rec_cnt
; /* Number of records */
133 /* Variable length fields */
134 u_char sm_sid
[]; /* Sender ID (variable) */
135 u_char sm_rid
[]; /* Receiver ID (variable) */
144 u_short se_type
; /* Extension type */
145 u_short se_len
; /* Length */
147 /* Variable length fields */
148 u_char se_value
[]; /* Extension value */
154 * Cache State Advertisement record or
155 * Cache State Advertisement Summary record
158 u_short scs_hop_cnt
; /* Hop count */
159 u_short scs_len
; /* Record length */
160 u_char scs_ck_len
; /* Cache key length */
161 u_char scs_oid_len
; /* Originator ID length */
162 u_short scs_nfill
; /* Null bit and filler */
163 long scs_seq
; /* Sequence number */
165 /* Variable length fields */
166 u_char scs_ckey
[]; /* Cache key */
167 u_char scs_oid
[]; /* Originator ID */
168 u_char scs_proto
[]; /* Protocol-specific (in CSA) */
172 #define SCSP_CSAS_NULL 0x8000
176 * Cache Alignment message
179 long sca_seq
; /* Sequence number */
180 struct scsp_nmcp sca_mcp
; /* Mandatory common */
182 /* Variable length fields */
183 struct scsp_ncsa sca_rec
[]; /* CSASs */
187 #define SCSP_CA_M 0x8000 /* Master/Slave bit */
188 #define SCSP_CA_I 0x4000 /* Initialization bit */
189 #define SCSP_CA_O 0x2000 /* More bit */
193 * Cache State Update Request, Cache State Update Reply, or
194 * Cache State Update Solicit message
196 struct scsp_ncsu_msg
{
197 struct scsp_nmcp scr_mcp
; /* Mandatory common */
199 /* Variable length fields */
200 struct scsp_ncsa scr_rec
[]; /* CSAs */
209 u_short sch_hi
; /* Hello interval */
210 u_short sch_df
; /* Dead factor */
211 u_short sch_fill_0
; /* Unused */
212 u_short sch_fid
; /* Family ID */
213 struct scsp_nmcp sch_mcp
; /* Mandatory common */
215 /* Variable-length fields */
216 struct scsp_nrid sch_rid
[]; /* Receiver IDs */
222 * ATMARP-specific Cache State Advertisement record
224 struct scsp_atmarp_ncsa
{
225 u_short sa_hrd
; /* Hardware type -- 0x0013 */
226 u_short sa_pro
; /* Protocol type -- 0x0800 */
227 u_char sa_shtl
; /* Src ATM addr type/len */
228 u_char sa_sstl
; /* Src ATM subaddr type/len */
229 u_char sa_state
; /* State */
230 u_char sa_fill1
; /* Unused */
231 u_char sa_spln
; /* Src proto addr type */
232 u_char sa_thtl
; /* Tgt ATM addr type/len */
233 u_char sa_tstl
; /* Tgt ATM subaddr type/len */
234 u_char sa_tpln
; /* Tgt proto addr len */
236 /* Variable-length fields */
237 u_char sa_sha
[]; /* Source ATM addr */
238 u_char sa_ssa
[]; /* Source ATM subaddr */
239 u_char sa_spa
[]; /* Source IP addr */
240 u_char sa_tha
[]; /* Target ATM addr */
241 u_char sa_tsa
[]; /* Target ATM subaddr */
242 u_char sa_tpa
[]; /* Target IP addr */
248 * NHRP-specific Cache State Advertisement record
250 struct scsp_nhrp_ncsa
{
251 u_short sn_af
; /* Address family */
252 u_short sn_pro
; /* NHRP protocol type */
253 u_char sn_snap
[5]; /* SNAP header */
254 u_char sn_ver
; /* NHRP version no. */
255 u_short sn_flags
; /* Flags */
256 u_long sn_rid
; /* Request ID */
257 u_char sn_state
; /* State */
258 u_char sn_pln
; /* Prefix length */
259 u_short sn_fill1
; /* Unused */
260 u_short sn_mtu
; /* MTU */
261 u_short sn_hold
; /* Holding time */
262 u_char sn_csatl
; /* Client addr type/len */
263 u_char sn_csstl
; /* Client subaddr type/len */
264 u_char sn_cpln
; /* Client proto addr len */
265 u_char sn_pref
; /* Preference for next hop */
267 /* Variable-length fields */
268 u_char sn_csa
[]; /* Client subnetwork addr */
269 u_char sn_css
[]; /* Client subnetwork subaddr */
270 u_char sn_cpa
[]; /* Client protocol addr */
276 * SCSP messages in internal format
279 * Fixed message header
282 u_char msg_type
; /* Message type */
284 typedef struct scsp_hdr Scsp_hdr
;
288 * Sender or Receiver ID structure
291 struct scsp_id
*next
; /* Next ID */
292 u_char id_len
; /* ID length */
293 u_char id
[SCSP_MAX_ID_LEN
]; /* ID */
295 typedef struct scsp_id Scsp_id
;
299 * Cacke Key structure
302 u_char key_len
; /* Cache key length */
303 u_char key
[SCSP_MAX_KEY_LEN
]; /* Cache key */
305 typedef struct scsp_ckey Scsp_ckey
;
309 * Mandatory common part
312 u_short pid
; /* Protocol ID */
313 u_short sgid
; /* Server group ID */
314 u_short flags
; /* Flags */
315 u_short rec_cnt
; /* No. of records attached */
316 Scsp_id sid
; /* Sender ID */
317 Scsp_id rid
; /* Receiver ID */
319 typedef struct scsp_mcp Scsp_mcp
;
326 struct scsp_ext
*next
; /* Next extension */
327 u_short type
; /* Extension type */
328 u_short len
; /* Length */
330 /* Variable length fields */
331 u_char value
[]; /* Extension value */
334 typedef struct scsp_ext Scsp_ext
;
338 * Cache State Advertisement record or
339 * Cache State Advertisement Summary record
342 struct scsp_csa
*next
; /* Next CSAS record */
343 u_short hops
; /* Hop count */
344 u_char null
; /* Null flag */
345 u_long seq
; /* CSA seq. no. */
346 Scsp_ckey key
; /* Cache key */
347 Scsp_id oid
; /* Originator ID */
348 int trans_ct
; /* No. of times CSA sent */
349 struct scsp_atmarp_csa
*atmarp_data
; /* ATMARP data */
351 struct scsp_nhrp_csa
*nhrp_data
; /* NHRP data */
354 typedef struct scsp_csa Scsp_csa
;
357 * Macro to free a CSA and any associated protocol-specific data
359 #define SCSP_FREE_CSA(c) \
361 if ((c)->atmarp_data) { \
362 UM_FREE((c)->atmarp_data); \
369 * Cache Alignment message
372 long ca_seq
; /* CA msg sequence no. */
373 u_char ca_m
; /* Master/slave bit */
374 u_char ca_i
; /* Initialization bit */
375 u_char ca_o
; /* More bit */
376 Scsp_mcp ca_mcp
; /* Mandatory common part */
377 Scsp_csa
*ca_csa_rec
; /* Ptr. to CSAS records */
379 typedef struct scsp_ca Scsp_ca
;
383 * Cache State Update Request, Cache State Update Reply, or
384 * Cache State Update Solicit message
386 struct scsp_csu_msg
{
387 Scsp_mcp csu_mcp
; /* Mandatory common part */
388 Scsp_csa
*csu_csa_rec
; /* Ptr. to CSA records */
390 typedef struct scsp_csu_msg Scsp_csu_msg
;
397 u_short hello_int
; /* Hello interval */
398 u_short dead_factor
; /* When is DCS dead? */
399 u_short family_id
; /* Family ID */
400 Scsp_mcp hello_mcp
; /* Mandatory common part */
402 typedef struct scsp_hello Scsp_hello
;
406 * NHRP-specific Cache State Advertisement record
408 struct scsp_nhrp_csa
{
409 u_char req_id
; /* Request ID */
410 u_char state
; /* State */
411 u_char pref_len
; /* Prefix length */
412 u_short flags
; /* See below */
413 u_short mtu
; /* Maximim transmission unit */
414 u_short hold_time
; /* Entry holding time */
415 u_char caddr_tlen
; /* Client addr type/length */
416 u_char csaddr_tlen
; /* Client subaddr type/length */
417 u_char cproto_len
; /* Client proto addr length */
418 u_char pref
; /* Preference */
419 Atm_addr caddr
; /* Client address */
420 Atm_addr csaddr
; /* Client subaddress */
421 struct in_addr cproto_addr
; /* Client protocol address */
423 typedef struct scsp_nhrp Scsp_nhrp
;
425 #define SCSP_NHRP_UNIQ 0x8000
426 #define SCSP_NHRP_ARP 0x4000
430 * ATMARP-specific Cache State Advertisement record
432 struct scsp_atmarp_csa
{
433 u_char sa_state
; /* State */
434 Atm_addr sa_sha
; /* Source ATM addr */
435 Atm_addr sa_ssa
; /* Source ATM subaddr */
436 struct in_addr sa_spa
; /* Source IP addr */
437 Atm_addr sa_tha
; /* Target ATM addr */
438 Atm_addr sa_tsa
; /* Target ATM subaddr */
439 struct in_addr sa_tpa
; /* Target IP addr */
441 typedef struct scsp_atmarp_csa Scsp_atmarp_csa
;
451 Scsp_csu_msg
*sc_u_csu_msg
;
452 Scsp_hello
*sc_u_hello
;
456 typedef struct scsp_msg Scsp_msg
;
458 #define sc_msg_type sc_hdr.msg_type
459 #define sc_ca sc_msg_u.sc_u_ca
460 #define sc_csu_msg sc_msg_u.sc_u_csu_msg
461 #define sc_hello sc_msg_u.sc_u_hello
463 #endif /* _SCSP_SCSP_MSG_H */