summaryrefslogtreecommitdiffstats
path: root/usr.sbin/atm/scspd/scsp_msg.h
blob: 3ee3bf59a5226142a94ac868fa0e4ec5a4f8b6cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
/*
 *
 * ===================================
 * HARP  |  Host ATM Research Platform
 * ===================================
 *
 *
 * This Host ATM Research Platform ("HARP") file (the "Software") is
 * made available by Network Computing Services, Inc. ("NetworkCS")
 * "AS IS".  NetworkCS does not provide maintenance, improvements or
 * support of any kind.
 *
 * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
 * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
 * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
 * In no event shall NetworkCS be responsible for any damages, including
 * but not limited to consequential damages, arising from or relating to
 * any use of the Software or related support.
 *
 * Copyright 1994-1998 Network Computing Services, Inc.
 *
 * Copies of this Software may be made, however, the above copyright
 * notice must be reproduced on all copies.
 *
 *	@(#) $Id: scsp_msg.h,v 1.1 1998/07/10 15:29:02 johnc Exp $
 *
 */

/*
 * Server Cache Synchronization Protocol (SCSP) Support
 * ----------------------------------------------------
 *
 * SCSP message formats
 *
 */

#ifndef _SCSP_SCSP_MSG_H
#define _SCSP_SCSP_MSG_H


/*
 * ATMARP constants
 */
#define	ARP_ATMFORUM	19
#define	ARP_TL_TMASK	0x40		/* Type mask */
#define	ARP_TL_NSAPA	0x00		/* Type = ATM Forum NSAPA */
#define	ARP_TL_E164	0x40		/* Type = E.164 */
#define	ARP_TL_LMASK	0x3f		/* Length mask */


/*
 * SCSP version number
 */
#define	SCSP_VER_1	1


/*
 * SCSP message types
 */
#define	SCSP_CA_MSG		1
#define	SCSP_CSU_REQ_MSG	2
#define	SCSP_CSU_REPLY_MSG	3
#define	SCSP_CSUS_MSG		4
#define	SCSP_HELLO_MSG		5


/*
 * SCSP Client Protocol IDs
 */
#define	SCSP_PROTO_ATMARP	1
#define	SCSP_PROTO_NHRP		2
#define	SCSP_PROTO_MARS		3
#define	SCSP_PROTO_DHCP		4
#define	SCSP_PROTO_LNNI		5


/*
 * Extension types
 */
#define	SCSP_EXT_END	0
#define	SCSP_EXT_AUTH	1
#define	SCSP_EXT_VENDOR	2

/*
 * Sequence number bounds
 */
#define	SCSP_CSA_SEQ_MIN	0x80000001
#define SCSP_CSA_SEQ_MAX	0x7FFFFFFF


/*
 * Sender, Receiver, or Originator ID lengths
 */
#define	SCSP_ATMARP_ID_LEN	4
#define	SCSP_NHRP_ID_LEN	4
#define	SCSP_MAX_ID_LEN		4


/*
 * Cache Key lengths
 */
#define	SCSP_ATMARP_KEY_LEN	4
#define	SCSP_NHRP_KEY_LEN	4
#define	SCSP_MAX_KEY_LEN	4


/*
 * Fixed header
 */
struct scsp_nhdr {
	u_char	sh_ver;			/* SCSP version */
	u_char	sh_type;		/* Message type */
	u_short	sh_len;			/* Message length */
	u_short	sh_checksum;		/* IP checksum over message */
	u_short	sh_ext_off;		/* Offset of first extension */
};


/*
 * Mandatory common part
 */
struct scsp_nmcp {
	u_short	sm_pid;			/* Protocol ID */
	u_short	sm_sgid;		/* Server group ID */
	u_short	sm_fill_0;		/* Unused */
	u_short	sm_flags;		/* Flags--see below */
	u_char	sm_sid_len;		/* Sender ID length */
	u_char	sm_rid_len;		/* Receiver ID length */
	u_short	sm_rec_cnt;		/* Number of records */
#ifdef	NOTDEF
	/* Variable length fields */
	u_char	sm_sid[];		/* Sender ID (variable) */
	u_char	sm_rid[];		/* Receiver ID (variable) */
#endif
};


/*
 * Extensions part
 */
struct scsp_next {
	u_short	se_type;		/* Extension type */
	u_short	se_len;			/* Length */
#ifdef	NOTDEF
	/* Variable length fields */
	u_char	se_value[];		/* Extension value */
#endif
};


/*
 * Cache State Advertisement record or
 *    Cache State Advertisement Summary record
 */
struct scsp_ncsa {
	u_short	scs_hop_cnt;		/* Hop count */
	u_short	scs_len;		/* Record length */
	u_char	scs_ck_len;		/* Cache key length */
	u_char	scs_oid_len;		/* Originator ID length */
	u_short	scs_nfill;		/* Null bit and filler */
	long	scs_seq;		/* Sequence number */
#ifdef NOTDEF
	/* Variable length fields */
	u_char	scs_ckey[];		/* Cache key */
	u_char	scs_oid[];		/* Originator ID */
	u_char	scs_proto[];		/* Protocol-specific (in CSA) */
#endif
};

#define	SCSP_CSAS_NULL	0x8000


/*
 * Cache Alignment message
 */
struct scsp_nca {
	long			sca_seq;	/* Sequence number */
	struct scsp_nmcp	sca_mcp;	/* Mandatory common */
#ifdef NOTDEF
	/* Variable length fields */
	struct scsp_ncsa	sca_rec[];	/* CSASs */
#endif
};

#define	SCSP_CA_M	0x8000		/* Master/Slave bit */
#define	SCSP_CA_I	0x4000		/* Initialization bit */
#define	SCSP_CA_O	0x2000		/* More bit */


/*
 * Cache State Update Request, Cache State Update Reply, or
 * Cache State Update Solicit message
 */
struct scsp_ncsu_msg {
	struct scsp_nmcp	scr_mcp;	/* Mandatory common */
#ifdef NOTDEF
	/* Variable length fields */
	struct scsp_ncsa	scr_rec[];	/* CSAs */
#endif
};


/*
 * Hello message
 */
struct scsp_nhello {
	u_short			sch_hi;		/* Hello interval */
	u_short			sch_df;		/* Dead factor */
	u_short			sch_fill_0;	/* Unused */
	u_short			sch_fid;	/* Family ID */
	struct scsp_nmcp	sch_mcp;	/* Mandatory common */
#ifdef NOTDEF
	/* Variable-length fields */
	struct scsp_nrid	sch_rid[];	/* Receiver IDs */
#endif
};


/*
 * ATMARP-specific Cache State Advertisement record
 */
struct scsp_atmarp_ncsa {
	u_short	sa_hrd;			/* Hardware type -- 0x0013 */
	u_short	sa_pro;			/* Protocol type -- 0x0800 */
	u_char	sa_shtl;		/* Src ATM addr type/len */
	u_char	sa_sstl;		/* Src ATM subaddr type/len */
	u_char	sa_state;		/* State */
	u_char	sa_fill1;		/* Unused */
	u_char	sa_spln;		/* Src proto addr type */
	u_char	sa_thtl;		/* Tgt ATM addr type/len */
	u_char	sa_tstl;		/* Tgt ATM subaddr type/len */
	u_char	sa_tpln;		/* Tgt proto addr len */
#ifdef NOTDEF
	/* Variable-length fields */
	u_char	sa_sha[];		/* Source ATM addr */
	u_char	sa_ssa[];		/* Source ATM subaddr */
	u_char	sa_spa[];		/* Source IP addr */
	u_char	sa_tha[];		/* Target ATM addr */
	u_char	sa_tsa[];		/* Target ATM subaddr */
	u_char	sa_tpa[];		/* Target IP addr */
#endif
};


/*
 * NHRP-specific Cache State Advertisement record
 */
struct scsp_nhrp_ncsa {
	u_short	sn_af;			/* Address family */
	u_short	sn_pro;			/* NHRP protocol type */
	u_char	sn_snap[5];		/* SNAP header */
	u_char	sn_ver;			/* NHRP version no. */
	u_short	sn_flags;		/* Flags */
	u_long	sn_rid;			/* Request ID */
	u_char	sn_state;		/* State */
	u_char	sn_pln;			/* Prefix length */
	u_short	sn_fill1;		/* Unused */
	u_short	sn_mtu;			/* MTU */
	u_short	sn_hold;		/* Holding time */
	u_char	sn_csatl;		/* Client addr type/len */
	u_char	sn_csstl;		/* Client subaddr type/len */
	u_char	sn_cpln;		/* Client proto addr len */
	u_char	sn_pref;		/* Preference for next hop */
#ifdef NOTDEF
	/* Variable-length fields */
	u_char	sn_csa[];		/* Client subnetwork addr */
	u_char	sn_css[];		/* Client subnetwork subaddr */
	u_char	sn_cpa[];		/* Client protocol addr */
#endif
};


/*
 * SCSP messages in internal format
 *
 *
 * Fixed message header
 */
struct scsp_hdr {
	u_char	msg_type;		/* Message type */
};
typedef	struct scsp_hdr Scsp_hdr;


/*
 * Sender or Receiver ID structure
 */
struct scsp_id {
	struct scsp_id	*next;			/* Next ID */
	u_char		id_len;			/* ID length */
	u_char		id[SCSP_MAX_ID_LEN];	/* ID */
};
typedef	struct scsp_id	Scsp_id;


/*
 * Cacke Key structure
 */
struct scsp_ckey {
	u_char		key_len;		/* Cache key length */
	u_char		key[SCSP_MAX_KEY_LEN];	/* Cache key */
};
typedef	struct scsp_ckey	Scsp_ckey;


/*
 * Mandatory  common part
 */
struct scsp_mcp {
	u_short		pid;		/* Protocol ID */
	u_short		sgid;		/* Server group ID */
	u_short		flags;		/* Flags */
	u_short		rec_cnt;	/* No. of records attached */
	Scsp_id		sid;		/* Sender ID */
	Scsp_id		rid;		/* Receiver ID */
};
typedef	struct scsp_mcp	Scsp_mcp;


/*
 * Extensions part
 */
struct scsp_ext {
	struct scsp_ext	*next;		/* Next extension */
	u_short		type;		/* Extension type */
	u_short		len;		/* Length */
#ifdef	NOTDEF
	/* Variable length fields */
	u_char		value[];	/* Extension value */
#endif
};
typedef	struct scsp_ext	Scsp_ext;


/*
 * Cache State Advertisement record or
 *    Cache State Advertisement Summary record
 */
struct scsp_csa {
	struct scsp_csa	*next;		/* Next CSAS record */
	u_short		hops;		/* Hop count */
	u_char		null;		/* Null flag */
	u_long		seq;		/* CSA seq. no. */
	Scsp_ckey	key;		/* Cache key */
	Scsp_id		oid;		/* Originator ID */
	int		trans_ct;	/* No. of times CSA sent */
	struct scsp_atmarp_csa	*atmarp_data;	/* ATMARP data */
#ifdef NOTDEF
	struct scsp_nhrp_csa	*nhrp_data;	/* NHRP data */
#endif
};
typedef	struct scsp_csa	Scsp_csa;

/*
 * Macro to free a CSA and any associated protocol-specific data
 */
#define	SCSP_FREE_CSA(c)					\
{								\
	if ((c)->atmarp_data) {					\
		UM_FREE((c)->atmarp_data);			\
	}							\
	UM_FREE((c));						\
}


/*
 * Cache Alignment message
 */
struct scsp_ca {
	long		ca_seq;		/* CA msg sequence no. */
	u_char		ca_m;		/* Master/slave bit */
	u_char		ca_i;		/* Initialization bit */
	u_char		ca_o;		/* More bit */
	Scsp_mcp	ca_mcp;		/* Mandatory common part */
	Scsp_csa	*ca_csa_rec;	/* Ptr. to CSAS records */
};
typedef	struct scsp_ca	Scsp_ca;


/*
 * Cache State Update Request, Cache State Update Reply, or
 * Cache State Update Solicit message
 */
struct scsp_csu_msg {
	Scsp_mcp	csu_mcp;	/* Mandatory common part */
	Scsp_csa	*csu_csa_rec;	/* Ptr. to CSA records */
};
typedef	struct scsp_csu_msg	Scsp_csu_msg;


/*
 * Hello message
 */
struct scsp_hello {
	u_short		hello_int;	/* Hello interval */
	u_short		dead_factor;	/* When is DCS dead? */
	u_short		family_id;	/* Family ID */
	Scsp_mcp	hello_mcp;	/* Mandatory common part */
};
typedef struct scsp_hello	Scsp_hello;


/*
 * NHRP-specific Cache State Advertisement record
 */
struct scsp_nhrp_csa {
	u_char	req_id;			/* Request ID */
	u_char	state;			/* State */
	u_char	pref_len;		/* Prefix length */
	u_short	flags;			/* See below */
	u_short	mtu;			/* Maximim transmission unit */
	u_short	hold_time;		/* Entry holding time */
	u_char	caddr_tlen;		/* Client addr type/length */
	u_char	csaddr_tlen;		/* Client subaddr type/length */
	u_char	cproto_len;		/* Client proto addr length */
	u_char	pref;			/* Preference */
	Atm_addr	caddr;		/* Client address */
	Atm_addr	csaddr;		/* Client subaddress */
	struct in_addr	cproto_addr;	/* Client protocol address */
};
typedef	struct scsp_nhrp	Scsp_nhrp;

#define	SCSP_NHRP_UNIQ	0x8000
#define	SCSP_NHRP_ARP	0x4000


/*
 * ATMARP-specific Cache State Advertisement record
 */
struct scsp_atmarp_csa {
	u_char		sa_state;	/* State */
	Atm_addr	sa_sha;		/* Source ATM addr */
	Atm_addr	sa_ssa;		/* Source ATM subaddr */
	struct in_addr	sa_spa;		/* Source IP addr */
	Atm_addr	sa_tha;		/* Target ATM addr */
	Atm_addr	sa_tsa;		/* Target ATM subaddr */
	struct in_addr	sa_tpa;		/* Target IP addr */
};
typedef	struct scsp_atmarp_csa	Scsp_atmarp_csa;


/*
 * SCSP message
 */
struct scsp_msg {
	Scsp_hdr	sc_hdr;
	union {
		Scsp_ca		*sc_u_ca;
		Scsp_csu_msg	*sc_u_csu_msg;
		Scsp_hello	*sc_u_hello;
	} sc_msg_u;
	Scsp_ext	*sc_ext;
};
typedef	struct scsp_msg	Scsp_msg;

#define	sc_msg_type	sc_hdr.msg_type
#define	sc_ca		sc_msg_u.sc_u_ca
#define	sc_csu_msg	sc_msg_u.sc_u_csu_msg
#define	sc_hello	sc_msg_u.sc_u_hello

#endif	/* _SCSP_SCSP_MSG_H */
OpenPOWER on IntegriCloud