File: dis.x

package info (click to toggle)
acm 5.0-23.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 8,364 kB
  • ctags: 4,793
  • sloc: ansic: 42,444; makefile: 706; cpp: 293; perl: 280; sh: 198
file content (602 lines) | stat: -rwxr-xr-x 13,874 bytes parent folder | download | duplicates (9)
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
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
/*
 *   DIS/x : An implementation of the IEEE 1278.1 protocol
 *
 *   Copyright (C) 1996-1998, Riley Rainey (rainey@netcom.com)
 *
 *   This library is free software; you can redistribute it and/or
 *   modify it under the terms of either:
 *
 *   a) the GNU Library General Public License as published by the Free
 *   Software Foundation; either version 2 of the License, or (at your
 *   option) any later version.  A description of the terms and conditions
 *   of the GLPL may be found in the "COPYING.LIB" file.
 *
 *   b) the "Artistic License" which comes with this Kit.  Information
 *   about this license may be found in the "Artistic" file.
 *
 *   This library is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *   Library General Public License or the Artistic License for more details.
 *
 *   You should have received a copy of the GNU Library General Public
 *   License along with this library; if not, write to the Free
 *   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *   Information describing how to contact the author can be found in the
 *   README file.
 */
/*
 *  DIS 2.04 Protocol definition
 *
 *  Copyright (c) 1995, Riley Rainey (riley@netcom.com)
 *
 *  The following Protocol Data Unit (PDU) classes are defined in this file:
 *
 *  Entity Information/Interaction
 *  Warfare
 *  Simulation Management
 *  Distributed Emission Regeneration
 *
 *  Note that some DIS PDUs or related data structures do not conform to
 *  the strict RPCGEN model of data layout.  In those cases, XDR routines
 *  had to be generated manually (see dis_xdr1.c).  Definitions for those
 *  structures are included included in this file, protected by
 *  "#ifdef RPC_HDR" directives.
 *
 *  Also note that we post-process the rpcgen output before it gets
 *  compiled.  Specifically, XDR says that short's and char's must be padded
 *  to 4-byte boundaries in a network data stream.  This padding was short-
 *  circuited by creating xdr_byte_* routines that look just like the
 *  corresponding xdr_* routine (i.e. there is an xdr_byte_short routine
 *  that does what xdr_short does except that it omits the padding).  This
 *  change implies that padding must be defined in the protocol definition
 *  (in this file) where needed.  The xdr_byte_* routines are defined in
 *  dis_xdr2.c.
 */

#ifdef RPC_XDR
%#define _DIS_PRIVATE	1
%#include <dis/dis_xdr.h>
#endif

struct dis_float_vector {
	float			x;
	float			y;
	float			z;
	};

struct dis_angular_vel_vector {
	float			x;
	float			y;
	float			z;
	};

struct dis_linear_acc_vector {
	float			x;
	float			y;
	float			z;
	};

struct dis_linear_vel_vector {
	float			x;
	float			y;
	float			z;
	};

struct dis_entity_coord_vector {
	float			x;
	float			y;
	float			z;
	};

struct dis_entity_type  {
	unsigned char		kind;
	unsigned char		domain;
	unsigned short		country;
	unsigned char		category;
	unsigned char		subcategory;
	unsigned char		specific;
	unsigned char		extra;
	};

struct dis_entity_marking {
	unsigned char		charset;
	unsigned char		marking[11];
	};

struct dis_fixed_datum {
	unsigned long		datum_id;
	unsigned long	ulong_value;
	};

#ifdef RPC_HDR
%typedef struct {
%	unsigned long		datum_id;
%	unsigned long		value_length;
%	union {
%	    double		    double_value;
%	    dis_entity_type	entity_type_value;
%	    unsigned char	*ptr_value;
%	} value;
%	} dis_variable_datum;
%
%typedef struct {
%	unsigned 		time:31; /* 1.676... usec units */
%	unsigned		type:1;	 /* type: 0=relative, 1=absolute */
%	} dis_timestamp;
#endif

struct dis_simulation_addr {
	unsigned short		site_id;
	unsigned short		application_id;
	};

struct dis_emitter_system {
	unsigned short		name;
	unsigned char		function;
	unsigned char		id;
	};

struct dis_entity_id  {
	dis_simulation_addr	sim_id;
	unsigned short		entity_id;
	};

struct dis_euler_angles {
	float			psi;
	float			theta;
	float			phi;
	};
	
struct dis_event_id {
	dis_simulation_addr	sim_id;
	unsigned short		event_id;
	};

struct dis_fundamental_parameters {
	float			freq;
	float			freq_range;
	float			erp;
	float			prf;
	float			pulse_width;
	float			beam_azimuth_center;
	float			beam_azimuth_sweep;
	float			beam_elev_center;
	float			beam_elev_sweep;
	float			beam_sweep_sync;
	};

struct dis_modulation_type {
	unsigned short		spread_spectrum;
	unsigned short		major_type;
	unsigned short		detail;
	unsigned short		system;
	};

struct dis_pdu_header {
	unsigned char		protocol_version;
	unsigned char		exercise_id;
	unsigned char		pdu_type;
	unsigned char		protocol_family;
	dis_timestamp		time_stamp;
	unsigned short		length;
	unsigned short		padding;
	};

struct dis_double_vector {
	double			x;
	double			y;
	double			z;
	};

struct dis_world_coordinates {
	double			x;
	double			y;
	double			z;
	};

struct dis_relative_coordinates {
	float			x;
	float			y;
	float			z;
	};

struct dis_antenna_location {
	dis_world_coordinates		ant_location;
	dis_relative_coordinates	relative;
	};

struct dis_beam_antenna_pattern {
	dis_euler_angles	direction;
	float			azimuth_width;
	float			elev_width;
	unsigned char		reference_system;
	unsigned char		pad[3];
	float			Ez;
	float			Ex;
	float			phase;
	};

struct dis_spherical_harmonic_antenna_pattern {
	unsigned char		pattern;
	float			coefficients;
	unsigned char		ref_system;
	};

#ifdef RPC_HDR
%typedef union {
%	double	d;
%	float	f[2];
%	char	c[8];
%	long	l[2];
%	short	s[4];
%	} dis_parm_value;
%
%typedef struct {
%	unsigned char		type;
%	unsigned char		change;
%	unsigned short		id;
%	unsigned long		parm_type;
%	dis_parm_value		value;
%	} dis_articulation_parm;
#endif

struct dis_time {
	unsigned long		hour;	/* hours since 1 Jan, 1970 */
	dis_timestamp		rel;
	};

struct dis_burst_descriptor {
	dis_entity_type		munition;
	unsigned short		warhead;
	unsigned short		fuze;
	unsigned short		quantity;
	unsigned short		rate;
	};

struct dis_dead_reckoning {
	unsigned char		algorithm;
	unsigned char		other[15];
	dis_linear_acc_vector	linear_acc;
	dis_angular_vel_vector	angular_vel;
	};

typedef unsigned long dis_capabilities;

struct dis_supply_quantity {
	dis_entity_type		entity;
	float			quantity;
	};

typedef unsigned long dis_entity_appearance;

/*
 *  PDUs
 */

struct dis_entity_state_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		id;
	unsigned char		force_id;
	unsigned char		art_parm_count;	
	dis_entity_type		type;
	dis_entity_type		alt_type;
	dis_linear_vel_vector	vel;
	dis_world_coordinates	pos;
	dis_euler_angles	orientation;
	dis_entity_appearance	appearance;
	dis_dead_reckoning	dr_parm;
	dis_entity_marking	marking;
	dis_capabilities	capabilities;
	dis_articulation_parm	art_parm[art_parm_count];
	};

struct dis_collision_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		id;
	dis_entity_id		collision_id;
	dis_event_id		event;
	dis_linear_vel_vector	vel;
	unsigned long		mass;
	dis_entity_coord_vector loc;
	};

struct dis_fire_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		firing_id;
	dis_entity_id		target_id;
	dis_entity_id		munition_id;
	dis_event_id		event;
	unsigned long		fire_mission_index;
	dis_world_coordinates	pos;
	dis_burst_descriptor	burst;
	dis_linear_vel_vector	vel;
	float			range;		/* meters */
	};

struct  dis_detonation_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		firing_id;
	dis_entity_id		target_id;
	dis_entity_id		munition_id;
	dis_event_id		event;
	dis_linear_vel_vector	vel;
	dis_world_coordinates	pos;
	dis_burst_descriptor	burst;
	dis_entity_coord_vector loc;
	unsigned char		result;
	unsigned char		num_art_parms;
	unsigned short		pad;
	dis_articulation_parm	art_parm[num_art_parms];
	};

/*
 *  Repair/Resupply
 */

typedef unsigned char	dis_service_type;
typedef unsigned short	dis_repair_type;
typedef unsigned char	dis_repair_result;

struct dis_service_request_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		requestor_id;
	dis_entity_id		server_id;
	dis_service_type	requested_service;
	unsigned char		num_supply_types;
	unsigned short		pad;
	dis_supply_quantity	supplies[num_supply_types];
	};

struct dis_resupply_offer_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		receiver_id;
	dis_entity_id		supplier_id;
	unsigned char		num_supply_types;
	unsigned char		pad[3];
	dis_supply_quantity	supplies[num_supply_types];
	};

struct dis_resupply_received_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		receiver_id;
	dis_entity_id		supplier_id;
	unsigned char		num_supply_types;
	unsigned char		pad[3];
	dis_supply_quantity	supplies[num_supply_types];
	};

struct dis_resupply_cancel_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		receiver_id;
	dis_entity_id		supplier_id;
	};

struct dis_repair_complete_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		receiver_id;
	dis_entity_id		supplier_id;
	dis_repair_type		repair;
	unsigned short		pad;
	};

struct dis_repair_response_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		receiver_id;
	dis_entity_id		supplier_id;
	dis_repair_result	result;
	unsigned char		pad[3];
	};

/*
 *  Simulation Management
 */

typedef unsigned long dis_request_id;

struct dis_create_entity_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		orig_id;
	dis_entity_id		recv_id;
	dis_request_id		request_id;
	};

struct dis_remove_entity_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		orig_id;
	dis_entity_id		recv_id;
	dis_request_id		request_id;
	};

struct dis_start_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		orig_id;
	dis_entity_id		recv_id;
	dis_time		real_time;
	dis_time		sim_time;
	dis_request_id		request_id;
	};

struct dis_stop_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		orig_id;
	dis_entity_id		recv_id;
	dis_time		real_time;
	unsigned char		reason;
	unsigned char		behavior;
	unsigned char		pad[2];
	dis_request_id		request_id;
	};

struct dis_acknowledge_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		orig_id;
	dis_entity_id		recv_id;
	unsigned short		acknowledge_flag;
	unsigned short		resp_flag;
	dis_request_id		request_id;
	};

struct dis_data_query_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		orig_id;
	dis_entity_id		recv_id;
	dis_time		interval;
	dis_request_id		request_id;
	unsigned long		num_fixed_data;
	unsigned long		num_variable_data;
	unsigned long		fixed_datum_id[num_fixed_data];
	unsigned long		variable_datum_id[num_variable_data];
	};

struct dis_datum_spec_record {
	unsigned long		num_fixed_data;
	unsigned long		num_variable_data;
	dis_fixed_datum		fixed_datum[num_fixed_data];
	dis_variable_datum	variable_datum[num_variable_data];
	};

struct dis_set_data_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		orig_id;
	dis_entity_id		recv_id;
	dis_request_id		request_id;
	dis_datum_spec_record	datum_info;	
	};

struct dis_data_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		orig_id;
	dis_entity_id		recv_id;
	dis_request_id		request_id;
	dis_datum_spec_record	datum_info;	
	};

struct dis_event_report_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		orig_id;
	dis_entity_id		recv_id;
	dis_event_id		event_type;
	dis_datum_spec_record	datum_info;	
	};

struct dis_message_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		orig_id;
	dis_entity_id		recv_id;
	unsigned long		pad;
	unsigned long		num_variable_data;
	dis_variable_datum	variable_datum[num_variable_data];	
	};

/*
 *  Distributed Emission Regeneration PDUs
 */

struct dis_track_info {
	dis_entity_id		target;
	unsigned char		emitter_id;
	unsigned char		beam_id;
	};

struct dis_beam_info {
	unsigned char		beam_data_length;
	unsigned char		beam_id;
	unsigned short		beam_parm_index;
	dis_fundamental_parameters fundamental;
	unsigned char		beam_function;
	unsigned char		num_targets;
	unsigned char		high_density_track_jam;
	unsigned char		pad;
	unsigned long		jamming_mode;
	dis_track_info		tracked_target[num_targets];
	};

struct dis_em_system_info {
	unsigned char		sys_data_length;
	unsigned char		num_beams;
	unsigned short		pad;
	dis_emitter_system	emitter_system;
	dis_entity_coord_vector	location;
	dis_beam_info		beam[num_beams];
	};

struct dis_em_emission_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		emitter_id;
	dis_event_id		event;
	unsigned char		state_update;
	unsigned char		num_systems;
	unsigned short		pad;
	dis_em_system_info	system[num_systems];
	};

struct dis_designator_pdu {
	dis_pdu_header		hdr;
	dis_entity_id		designating_id;
	unsigned short		code_name;
	dis_entity_id		designated_id;
	unsigned char		pad;
	unsigned char		code;
	float			power;		/* watts */
	float			wavelength;	/* microns */
	dis_entity_coord_vector spot_rel;
	dis_world_coordinates	spot_pos;
	};

/*
 *  These two PDUs came to me from CALSPAN; I have no idea where they
 *  actually originated.
 */

struct dis_experimental_request_control_pdu {
	dis_pdu_header  hdr;
	dis_entity_id	requesting_id;
	dis_entity_id	control_target_id;
};

struct dis_experimental_grant_control_pdu {
	dis_pdu_header  hdr;
	dis_entity_id	granting_id;
	dis_entity_id	control_target_id;
};

struct dis_transfer_control_pdu {
    dis_pdu_header  hdr;
    dis_entity_id   orig_id;
    dis_entity_id   recv_id;
    unsigned long   request_id;
    unsigned char   reliability_service;
    unsigned char   transfer_type;
    dis_entity_id   target_id;
    unsigned long   num_record_sets;
    };

#ifdef RPC_HDR
%typedef union {
%	dis_pdu_header		hdr;
%	dis_entity_state_pdu	entity_state;
%	dis_collision_pdu	collision;
%
%	dis_fire_pdu		fire;
%	dis_detonation_pdu	detonation;
%
%	dis_create_entity_pdu	create_entity;
%	dis_remove_entity_pdu	remove_entity;
%	dis_start_pdu		start;
%	dis_stop_pdu		stop;
%	dis_acknowledge_pdu	acknowledge;
%	dis_data_query_pdu	data_query;
%	dis_set_data_pdu	set_data;
%	dis_data_pdu		data;
%	dis_event_report_pdu	event_report;
%	dis_message_pdu		message;
%
%	dis_em_emission_pdu	em_emission;
%	dis_designator_pdu	designator;
%   dis_transfer_control_pdu transfer_control;
%	dis_experimental_request_control_pdu request_control;
%	dis_experimental_grant_control_pdu grant_control;
%	} dis_pdu;
#endif