comparison packets.h @ 3:5a977ccbc7a9 default tip

Empty changelog
author darius
date Sat, 06 Dec 1997 05:41:29 +0000
parents
children
comparison
equal deleted inserted replaced
2:fba0b6e6cdc7 3:5a977ccbc7a9
1 /* $Id: packets.h,v 1.1.1.1 1997/12/06 05:41:29 darius Exp $ */
2
3 /*--------------------------------------------------------------------------
4 NETREK II -- Paradise 2.1 FILE: packets.h
5
6 Permission to use, copy, modify, and distribute this software and its
7 documentation for any NON-COMMERCIAL purpose (following the terms of
8 the GNU General Public License (read the file 'COPYING')) and without
9 fee is hereby granted, provided that this copyright notice appear in all
10 copies. No representations are made about the suitability of this
11 software for any purpose. This software is provided "as is" without
12 express or implied warranty.
13
14 Xtrek Copyright 1986 Chris Guthrie
15 Netrek (Xtrek II) Copyright 1989 Kevin P. Smith
16 Scott Silvey
17 Paradise II (Netrek II) Copyright 1993 Larry Denys
18 Kurt Olsen
19 Brandon Gillespie
20 Paradise II by:
21 Larry Denys, Kurt Olsen, Brandon Gillespie, and Rob Forsman
22 and:
23 Heath Kehoe, Mike Lutz, Mike McGrath, Ted Hadley, and Mark Kolb
24 --------------------------------------------------------------------------*/
25
26 /*
27 * Include file for socket I/O xtrek.
28 *
29 * Kevin P. Smith 1/29/89
30 */
31
32 #ifndef packets_h_
33 #define packets_h_
34
35 #define STATUS_TOKEN "\t@@@" /* ATM */
36
37 /* the following typedefs allow portability to machines without the
38 ubiquitous 32-bit architecture (KSR1, Cray, DEC Alpha) */
39
40 typedef unsigned int CARD32;
41 typedef unsigned short CARD16;
42 typedef unsigned char CARD8;
43
44 typedef int INT32;
45 typedef short INT16;
46 #if __STDC__ || defined(sgi) || defined(RS6K)
47 typedef signed char INT8;
48 #else
49 /* stupid compilers */
50 typedef char INT8;
51 #endif
52
53 /*
54 * TCP and UDP use identical packet formats; the only difference is that,
55 * when in UDP mode, all packets sent from server to client have a sequence
56 * number appended to them.
57 *
58 * (note: ALL packets, whether sent on the TCP or UDP channel, will have
59 * the sequence number. Thus it's important that client & server agree on
60 * when to switch. This was done to keep critical and non-critical data
61 * in sync.)
62 */
63
64 /* the various pad members of the structures are used for explicit
65 data alignment. They do not contain any data. All structures are
66 aligned to 4 bytes. If your compiler forces 8 byte alignment, you
67 will not be adhering to the netrek protocol.
68 */
69
70 /* packets sent from xtrek server to remote client */
71 #define SP_MESSAGE 1
72 #define SP_PLAYER_INFO 2 /* general player info not elsewhere */
73 #define SP_KILLS 3 /* # kills a player has */
74 #define SP_PLAYER 4 /* x,y for player */
75 #define SP_TORP_INFO 5 /* torp status */
76 #define SP_TORP 6 /* torp location */
77 #define SP_PHASER 7 /* phaser status and direction */
78 #define SP_PLASMA_INFO 8 /* player login information */
79 #define SP_PLASMA 9 /* like SP_TORP */
80 #define SP_WARNING 10 /* like SP_MESG */
81 #define SP_MOTD 11 /* line from .motd screen */
82 #define SP_YOU 12 /* info on you? */
83 #define SP_QUEUE 13 /* estimated loc in queue? */
84 #define SP_STATUS 14 /* galaxy status numbers */
85 #define SP_PLANET 15 /* planet armies & facilities */
86 #define SP_PICKOK 16 /* your team & ship was accepted */
87 #define SP_LOGIN 17 /* login response */
88 #define SP_FLAGS 18 /* give flags for a player */
89 #define SP_MASK 19 /* tournament mode mask */
90 #define SP_PSTATUS 20 /* give status for a player */
91 #define SP_BADVERSION 21 /* invalid version number */
92 #define SP_HOSTILE 22 /* hostility settings for a player */
93 #define SP_STATS 23 /* a player's statistics */
94 #define SP_PL_LOGIN 24 /* new player logs in */
95 #define SP_RESERVED 25 /* for future use */
96 #define SP_PLANET_LOC 26 /* planet name, x, y */
97
98 #define SP_SCAN 27 /* scan packet */
99 #define SP_UDP_REPLY 28 /* notify client of UDP status */
100 #define SP_SEQUENCE 29 /* sequence # packet */
101 #define SP_SC_SEQUENCE 30 /* this trans is semi-critical info */
102 #define SP_RSA_KEY 31 /* RSA data packet */
103
104 #define SP_MOTD_PIC 32 /* motd bitmap pictures */
105 #define SP_STATS2 33 /* new stats packet */
106 #define SP_STATUS2 34 /* new status packet */
107 #define SP_PLANET2 35 /* new planet packet */
108 #define SP_NEW_MOTD 36 /* New MOTD info notification uses */
109 #define SP_THINGY 37 /* thingy location */
110 #define SP_THINGY_INFO 38 /* thingy status */
111 #define SP_SHIP_CAP 39 /* ship capabilities */
112
113 #ifdef SHORT_PACKETS
114 #define SP_S_REPLY 40 /* reply to send-short request */
115 #define SP_S_MESSAGE 41 /* var. Message Packet */
116 #define SP_S_WARNING 42 /* Warnings with 4 Bytes */
117 #define SP_S_YOU 43 /* hostile,armies,whydead,etc .. */
118 #define SP_S_YOU_SS 44 /* your ship status */
119 #define SP_S_PLAYER 45 /* variable length player packet */
120 #endif
121
122 #define SP_PING 46 /* ping packet */
123
124 #ifdef SHORT_PACKETS
125 #define SP_S_TORP 47 /* variable length torp packet */
126 #define SP_S_TORP_INFO 48 /* SP_S_TORP with TorpInfo */
127 #define SP_S_8_TORP 49 /* optimized SP_S_TORP */
128 #define SP_S_PLANET 50 /* see SP_PLANET */
129
130 /* variable length packets */
131 #define VPLAYER_SIZE 4
132 #define SHORTVERSION 10 /* other number blocks, like UDP Version */
133 #endif
134
135 #define SP_GPARAM 51 /* game params packet */
136
137 /* the following is a family of packets with the same type, but a
138 discriminating subtype */
139 #define SP_PARADISE_EXT1 52
140 #define SP_PE1_MISSING_BITMAP 0
141 #define SP_PE1_NUM_MISSILES 1
142 /* end of packet 52 subtypes */
143 #define SP_TERRAIN2 53 /* Terrain packets */
144 #define SP_TERRAIN_INFO2 54 /* Terrain info */
145
146 #ifdef FEATURE
147 /* feature_spacket, response to feature_cpacket requests. identical structures */
148 #define SP_FEATURE 60
149 #endif
150
151 #ifdef RECORDER
152 /* special type tells us when to update the display on playback.
153 Not sent or received, only placed in the recorder file */
154 #define REC_UPDATE 127
155 #endif
156
157 /* packets sent from remote client to xtrek server */
158 #define CP_MESSAGE 1 /* send a message */
159 #define CP_SPEED 2 /* set speed */
160 #define CP_DIRECTION 3 /* change direction */
161 #define CP_PHASER 4 /* phaser in a direction */
162 #define CP_PLASMA 5 /* plasma (in a direction) */
163 #define CP_TORP 6 /* fire torp in a direction */
164 #define CP_QUIT 7 /* self destruct */
165 #define CP_LOGIN 8 /* log in (name, password) */
166 #define CP_OUTFIT 9 /* outfit to new ship */
167 #define CP_WAR 10 /* change war status */
168 #define CP_PRACTR 11 /* create practice robot? */
169 #define CP_SHIELD 12 /* raise/lower sheilds */
170 #define CP_REPAIR 13 /* enter repair mode */
171 #define CP_ORBIT 14 /* orbit planet/starbase */
172 #define CP_PLANLOCK 15 /* lock on planet */
173 #define CP_PLAYLOCK 16 /* lock on player */
174 #define CP_BOMB 17 /* bomb a planet */
175 #define CP_BEAM 18 /* beam armies up/down */
176 #define CP_CLOAK 19 /* cloak on/off */
177 #define CP_DET_TORPS 20 /* detonate enemy torps */
178 #define CP_DET_MYTORP 21 /* detonate one of my torps */
179 #define CP_COPILOT 22 /* toggle copilot mode */
180 #define CP_REFIT 23 /* refit to different ship type */
181 #define CP_TRACTOR 24 /* tractor on/off */
182 #define CP_REPRESS 25 /* pressor on/off */
183 #define CP_COUP 26 /* coup home planet */
184 #define CP_SOCKET 27 /* new socket for reconnection */
185 #define CP_OPTIONS 28 /* send my options to be saved */
186 #define CP_BYE 29 /* I'm done! */
187 #define CP_DOCKPERM 30 /* set docking permissions */
188 #define CP_UPDATES 31 /* set number of usecs per update */
189 #define CP_RESETSTATS 32 /* reset my stats packet */
190 #define CP_RESERVED 33 /* for future use */
191
192 #define CP_SCAN 34 /* ATM: request for player scan */
193
194 #define CP_UDP_REQ 35 /* request UDP on/off */
195 #define CP_SEQUENCE 36 /* sequence # packet */
196 #define CP_RSA_KEY 37 /* request MOTD */
197 #define CP_ASK_MOTD 38 /* request MOTD */
198
199 #define CP_PING_RESPONSE 42 /* client response */
200
201 #ifdef SHORT_PACKETS
202 #define CP_S_REQ 43
203 #define CP_S_THRS 44
204 #define CP_S_MESSAGE 45 /* vari. Message Packet */
205 #define CP_S_RESERVED 46
206 #define CP_S_DUMMY 47
207 #endif
208
209 #ifdef FEATURE
210 #define CP_FEATURE 60
211 #endif
212
213 #define SOCKVERSION 4
214 #define UDPVERSION 10 /* changing this blocks other */
215 /* versions */
216
217 struct packet_handler {
218 void (*handler) ();
219 };
220
221
222 /*
223 * These are server --> client packets
224 */
225
226 struct mesg_spacket {
227 INT8 type; /* SP_MESSAGE */
228 CARD8 m_flags;
229 CARD8 m_recpt;
230 CARD8 m_from;
231 char mesg[80];
232 };
233
234 struct plyr_info_spacket {
235 INT8 type; /* SP_PLAYER_INFO */
236 INT8 pnum;
237 INT8 shiptype;
238 INT8 team;
239 };
240
241 struct kills_spacket {
242 INT8 type; /* SP_KILLS */
243 INT8 pnum;
244 INT8 pad1;
245 INT8 pad2;
246 CARD32 kills; /* where 1234=12.34 kills and 0=0.00 kills */
247 };
248
249 struct player_spacket {
250 INT8 type; /* SP_PLAYER */
251 INT8 pnum;
252 CARD8 dir;
253 INT8 speed;
254 INT32 x, y;
255 };
256
257 struct torp_info_spacket {
258 INT8 type; /* SP_TORP_INFO */
259 INT8 war;
260 INT8 status; /* TFREE, TDET, etc... */
261 INT8 pad1; /* pad needed for cross cpu compatibility */
262 INT16 tnum;
263 INT16 pad2;
264 };
265
266 struct torp_spacket {
267 INT8 type; /* SP_TORP */
268 CARD8 dir;
269 INT16 tnum;
270 INT32 x, y;
271 };
272
273 /* Shapes of thingys. It would be best to add to the end of this list and
274 try to coordinate your additions with other hackers. */
275 enum thingy_types {
276 SHP_BLANK, SHP_MISSILE, SHP_BOOM, SHP_TORP, SHP_PLASMA, SHP_MINE,
277 SHP_PBOOM, SHP_FIGHTER, SHP_WARP_BEACON
278 };
279
280 struct thingy_info_spacket {
281 INT8 type; /* SP_THINGY_INFO */
282 INT8 war;
283 INT16 shape; /* a thingy_types */
284 INT16 tnum;
285 INT16 owner;
286 };
287
288 struct thingy_spacket {
289 INT8 type; /* SP_THINGY */
290 CARD8 dir;
291 INT16 tnum;
292 INT32 x, y;
293 };
294
295 struct phaser_spacket {
296 INT8 type; /* SP_PHASER */
297 INT8 pnum;
298 INT8 status; /* PH_HIT, etc... */
299 CARD8 dir;
300 INT32 x, y;
301 INT32 target;
302 };
303
304 struct plasma_info_spacket {
305 INT8 type; /* SP_PLASMA_INFO */
306 INT8 war;
307 INT8 status; /* TFREE, TDET, etc... */
308 INT8 pad1; /* pad needed for cross cpu compatibility */
309 INT16 pnum;
310 INT16 pad2;
311 };
312
313 struct plasma_spacket {
314 INT8 type; /* SP_PLASMA */
315 INT8 pad1;
316 INT16 pnum;
317 INT32 x, y;
318 };
319
320 struct warning_spacket {
321 INT8 type; /* SP_WARNING */
322 INT8 pad1;
323 INT8 pad2;
324 INT8 pad3;
325 char mesg[80];
326 };
327
328 struct motd_spacket {
329 INT8 type; /* SP_MOTD */
330 INT8 pad1;
331 INT8 pad2;
332 INT8 pad3;
333 char line[80];
334 };
335
336 struct you_spacket {
337 INT8 type; /* SP_YOU */
338 INT8 pnum; /* Guy needs to know this... */
339 INT8 hostile;
340 INT8 swar;
341 INT8 armies;
342 INT8 tractor; /* ATM - visible tractor (was pad1) */
343 CARD8 pad2;
344 CARD8 pad3;
345 CARD32 flags;
346 INT32 damage;
347 INT32 shield;
348 INT32 fuel;
349 INT16 etemp;
350 INT16 wtemp;
351 INT16 whydead;
352 INT16 whodead;
353 };
354
355 struct queue_spacket {
356 INT8 type; /* SP_QUEUE */
357 INT8 pad1;
358 INT16 pos;
359 };
360
361 struct status_spacket {
362 INT8 type; /* SP_STATUS */
363 INT8 tourn;
364 INT8 pad1;
365 INT8 pad2;
366 CARD32 armsbomb;
367 CARD32 planets;
368 CARD32 kills;
369 CARD32 losses;
370 CARD32 time;
371 CARD32 timeprod;
372 };
373
374 struct planet_spacket {
375 INT8 type; /* SP_PLANET */
376 INT8 pnum;
377 INT8 owner;
378 INT8 info;
379 INT16 flags;
380 INT16 pad2;
381 INT32 armies;
382 };
383
384 /* terrain info for Paradise terrain */
385 /* 5/16/95 rpg */
386
387 struct terrain_info_packet2 {
388 CARD8 type; /* SP_TERRAIN_INFO2 */
389 CARD8 pad;
390 CARD16 pad2;
391 CARD16 xdim;
392 CARD16 ydim;
393 };
394
395 struct terrain_packet2 {
396 CARD8 type; /* SP_TERRAIN2 */
397 CARD8 sequence;
398 CARD8 total_pkts;
399 CARD8 length;
400 CARD8 terrain_type[128]; /* Ugh... this needs to be fixed 5/16/95 rpg */
401 /* CARD16 terrain_alt1[128]; */
402 /* CARD16 terrain_alt2[128]; */
403 };
404
405 struct pickok_spacket {
406 INT8 type; /* SP_PICKOK */
407 INT8 state;
408 INT8 pad2;
409 INT8 pad3;
410 };
411
412 struct login_spacket {
413 INT8 type; /* SP_LOGIN */
414 INT8 accept; /* 1/0 */
415 INT8 pad2;
416 INT8 pad3;
417 INT32 flags;
418 char keymap[96];
419 };
420
421 struct flags_spacket {
422 INT8 type; /* SP_FLAGS */
423 INT8 pnum; /* whose flags are they? */
424 INT8 tractor; /* ATM - visible tractors */
425 INT8 pad2;
426 CARD32 flags;
427 };
428
429 struct mask_spacket {
430 INT8 type; /* SP_MASK */
431 INT8 mask;
432 INT8 pad1;
433 INT8 pad2;
434 };
435
436 struct pstatus_spacket {
437 INT8 type; /* SP_PSTATUS */
438 INT8 pnum;
439 INT8 status;
440 INT8 pad1;
441 };
442
443 struct badversion_spacket {
444 INT8 type; /* SP_BADVERSION */
445 INT8 why;
446 INT8 pad2;
447 INT8 pad3;
448 };
449
450 struct hostile_spacket {
451 INT8 type; /* SP_HOSTILE */
452 INT8 pnum;
453 INT8 war;
454 INT8 hostile;
455 };
456
457 struct stats_spacket {
458 INT8 type; /* SP_STATS */
459 INT8 pnum;
460 INT8 pad1;
461 INT8 pad2;
462 INT32 tkills; /* Tournament kills */
463 INT32 tlosses; /* Tournament losses */
464 INT32 kills; /* overall */
465 INT32 losses; /* overall */
466 INT32 tticks; /* ticks of tournament play time */
467 INT32 tplanets; /* Tournament planets */
468 INT32 tarmies; /* Tournament armies */
469 INT32 sbkills; /* Starbase kills */
470 INT32 sblosses; /* Starbase losses */
471 INT32 armies; /* non-tourn armies */
472 INT32 planets; /* non-tourn planets */
473 INT32 maxkills; /* max kills as player * 100 */
474 INT32 sbmaxkills; /* max kills as sb * 100 */
475 };
476
477 struct plyr_login_spacket {
478 INT8 type; /* SP_PL_LOGIN */
479 INT8 pnum;
480 INT8 rank;
481 INT8 pad1;
482 char name[16];
483 char monitor[16];
484 char login[16];
485 };
486
487 struct reserved_spacket {
488 INT8 type; /* SP_RESERVED */
489 INT8 pad1;
490 INT8 pad2;
491 INT8 pad3;
492 INT8 data[16];
493 };
494
495 struct planet_loc_spacket {
496 INT8 type; /* SP_PLANET_LOC */
497 INT8 pnum;
498 INT8 pad2;
499 INT8 pad3;
500 INT32 x;
501 INT32 y;
502 char name[16];
503 };
504
505 struct scan_spacket { /* ATM */
506 INT8 type; /* SP_SCAN */
507 INT8 pnum;
508 INT8 success;
509 INT8 pad1;
510 INT32 p_fuel;
511 INT32 p_armies;
512 INT32 p_shield;
513 INT32 p_damage;
514 INT32 p_etemp;
515 INT32 p_wtemp;
516 };
517
518 struct udp_reply_spacket { /* UDP */
519 INT8 type; /* SP_UDP_REPLY */
520 INT8 reply;
521 INT8 pad1;
522 INT8 pad2;
523 INT32 port;
524 };
525
526 struct sequence_spacket { /* UDP */
527 INT8 type; /* SP_SEQUENCE */
528 INT8 pad1;
529 CARD16 sequence;
530 };
531 struct sc_sequence_spacket { /* UDP */
532 INT8 type; /* SP_CP_SEQUENCE */
533 INT8 pad1;
534 CARD16 sequence;
535 };
536
537 /*
538 * Game configuration.
539 * KAO 1/23/93
540 */
541
542 struct ship_cap_spacket { /* Server configuration of client */
543 INT8 type; /* screw motd method */
544 INT8 operation; /* 0 = add/change a ship, 1 = remove a ship */
545 INT16 s_type; /* SP_SHIP_CAP */
546 INT16 s_torpspeed;
547 INT16 s_phaserrange;
548 INT32 s_maxspeed;
549 INT32 s_maxfuel;
550 INT32 s_maxshield;
551 INT32 s_maxdamage;
552 INT32 s_maxwpntemp;
553 INT32 s_maxegntemp;
554 INT16 s_width;
555 INT16 s_height;
556 INT16 s_maxarmies;
557 INT8 s_letter;
558 INT8 pad2;
559 char s_name[16];
560 INT8 s_desig1;
561 INT8 s_desig2;
562 INT16 s_bitmap;
563 };
564
565 struct motd_pic_spacket {
566 INT8 type; /* SP_MOTD_PIC */
567 INT8 pad1;
568 INT16 x, y, page;
569 INT16 width, height;
570 INT8 bits[1016];
571 };
572
573
574 /* This is used to send paradise style stats */
575 struct stats_spacket2 {
576 INT8 type; /* SP_STATS2 */
577 INT8 pnum;
578 INT8 pad1;
579 INT8 pad2;
580
581 INT32 genocides; /* number of genocides participated in */
582 INT32 maxkills; /* max kills ever * 100 */
583 INT32 di; /* destruction inflicted for all time * 100 */
584 INT32 kills; /* Kills in tournament play */
585 INT32 losses; /* Losses in tournament play */
586 INT32 armsbomb; /* Tournament armies bombed */
587 INT32 resbomb; /* resources bombed off */
588 INT32 dooshes; /* armies killed while being carried */
589 INT32 planets; /* Tournament planets conquered */
590 INT32 tticks; /* Tournament ticks */
591 /* SB/WB/JS stats are entirely separate */
592 INT32 sbkills; /* Kills as starbase */
593 INT32 sblosses; /* Losses as starbase */
594 INT32 sbticks; /* Time as starbase */
595 INT32 sbmaxkills; /* Max kills as starbase * 100 */
596 INT32 wbkills; /* Kills as warbase */
597 INT32 wblosses; /* Losses as warbase */
598 INT32 wbticks; /* Time as warbase */
599 INT32 wbmaxkills; /* Max kills as warbase * 100 */
600 INT32 jsplanets; /* planets assisted with in JS */
601 INT32 jsticks; /* ticks played as a JS */
602 INT32 rank; /* Ranking of the player */
603 INT32 royal; /* royaly, specialty, rank */
604 };
605
606 /* status info for paradise stats */
607 struct status_spacket2 {
608 INT8 type; /* SP_STATUS2 */
609 INT8 tourn;
610 INT8 pad1;
611 INT8 pad2;
612 CARD32 dooshes; /* total number of armies dooshed */
613 CARD32 armsbomb; /* all t-mode armies bombed */
614 CARD32 resbomb; /* resources bombed */
615 CARD32 planets; /* all t-mode planets taken */
616 CARD32 kills; /* all t-mode kills made */
617 CARD32 losses; /* all t-mode losses */
618 CARD32 sbkills; /* total kills in SB's */
619 CARD32 sblosses; /* total losses in Sb's */
620 CARD32 sbtime; /* total time in SB's */
621 CARD32 wbkills; /* kills in warbases */
622 CARD32 wblosses; /* losses in warbases */
623 CARD32 wbtime; /* total time played in wb's */
624 CARD32 jsplanets; /* total planets taken by jump ships */
625 CARD32 jstime; /* total time in a jump ship */
626 CARD32 time; /* t mode time in this game */
627 CARD32 timeprod; /* t-mode ship ticks--sort of like */
628 };
629
630
631 /* planet info for a paradise planet */
632 struct planet_spacket2 {
633 INT8 type; /* SP_PLANET2 */
634 INT8 pnum; /* planet number */
635 INT8 owner; /* owner of the planet */
636 INT8 info; /* who has touched planet */
637 INT32 flags; /* planet's flags */
638 INT32 timestamp; /* timestamp for info on planet */
639 INT32 armies; /* armies on the planet */
640 };
641
642 struct obvious_packet {
643 INT8 type; /* SP_NEW_MOTD */
644 INT8 pad1; /* CP_ASK_MOTD */
645 };
646
647 struct rsa_key_spacket {
648 INT8 type; /* SP_RSA_KEY */
649 INT8 pad1;
650 INT8 pad2;
651 INT8 pad3;
652 CARD8 data[KEY_SIZE];
653 };
654
655
656 struct ping_spacket {
657 INT8 type; /* SP_PING */
658 CARD8 number; /* id (ok to wrap) */
659 CARD16 lag; /* delay of last ping in ms */
660
661 CARD8 tloss_sc; /* total loss server-client 0-100% */
662 CARD8 tloss_cs; /* total loss client-server 0-100% */
663
664 CARD8 iloss_sc; /* inc. loss server-client 0-100% */
665 CARD8 iloss_cs; /* inc. loss client-server 0-100% */
666 };
667
668 struct paradiseext1_spacket {
669 INT8 type;
670 CARD8 subtype;
671 INT16 pad;
672 };
673
674 struct pe1_missing_bitmap_spacket {
675 INT8 type;
676 CARD8 subtype;
677
678 INT16 page;
679
680 INT16 x, y;
681 INT16 width, height;
682 };
683
684 struct pe1_num_missiles_spacket {
685 INT8 type; /* SP_PARADISE_EXT1 */
686 CARD8 subtype; /* SP_PE1_NUM_MISSILES */
687
688 INT16 num; /* number of missiles */
689 };
690
691 /*
692 * These are the client --> server packets
693 */
694
695 struct mesg_cpacket {
696 INT8 type; /* CP_MESSAGE */
697 INT8 group;
698 INT8 indiv;
699 INT8 pad1;
700 char mesg[80];
701 };
702
703 struct speed_cpacket {
704 INT8 type; /* CP_SPEED */
705 INT8 speed;
706 INT8 pad1;
707 INT8 pad2;
708 };
709
710 struct dir_cpacket {
711 INT8 type; /* CP_DIRECTION */
712 CARD8 dir;
713 INT8 pad1;
714 INT8 pad2;
715 };
716
717 struct phaser_cpacket {
718 INT8 type; /* CP_PHASER */
719 CARD8 dir;
720 INT8 pad1;
721 INT8 pad2;
722 };
723
724 struct plasma_cpacket {
725 INT8 type; /* CP_PLASMA */
726 CARD8 dir;
727 INT8 pad1;
728 INT8 pad2;
729 };
730
731 struct torp_cpacket {
732 INT8 type; /* CP_TORP */
733 CARD8 dir; /* direction to fire torp */
734 INT8 pad1;
735 INT8 pad2;
736 };
737
738 struct quit_cpacket {
739 INT8 type; /* CP_QUIT */
740 INT8 pad1;
741 INT8 pad2;
742 INT8 pad3;
743 };
744
745 struct login_cpacket {
746 INT8 type; /* CP_LOGIN */
747 INT8 query;
748 INT8 pad2;
749 INT8 pad3;
750 char name[16];
751 char password[16];
752 char login[16];
753 };
754
755 struct outfit_cpacket {
756 INT8 type; /* CP_OUTFIT */
757 INT8 team;
758 INT8 ship;
759 INT8 pad1;
760 };
761
762 struct war_cpacket {
763 INT8 type; /* CP_WAR */
764 INT8 newmask;
765 INT8 pad1;
766 INT8 pad2;
767 };
768
769 struct practr_cpacket {
770 INT8 type; /* CP_PRACTR */
771 INT8 pad1;
772 INT8 pad2;
773 INT8 pad3;
774 };
775
776 struct shield_cpacket {
777 INT8 type; /* CP_SHIELD */
778 INT8 state; /* up/down */
779 INT8 pad1;
780 INT8 pad2;
781 };
782
783 struct repair_cpacket {
784 INT8 type; /* CP_REPAIR */
785 INT8 state; /* on/off */
786 INT8 pad1;
787 INT8 pad2;
788 };
789
790 struct orbit_cpacket {
791 INT8 type; /* CP_ORBIT */
792 INT8 state; /* on/off */
793 INT8 pad1;
794 INT8 pad2;
795 };
796
797 struct planlock_cpacket {
798 INT8 type; /* CP_PLANLOCK */
799 INT8 pnum;
800 INT8 pad1;
801 INT8 pad2;
802 };
803
804 struct playlock_cpacket {
805 INT8 type; /* CP_PLAYLOCK */
806 INT8 pnum;
807 INT8 pad1;
808 INT8 pad2;
809 };
810
811 struct bomb_cpacket {
812 INT8 type; /* CP_BOMB */
813 INT8 state;
814 INT8 pad1;
815 INT8 pad2;
816 };
817
818 struct beam_cpacket {
819 INT8 type; /* CP_BEAM */
820 INT8 state;
821 INT8 pad1;
822 INT8 pad2;
823 };
824
825 struct cloak_cpacket {
826 INT8 type; /* CP_CLOAK */
827 INT8 state;
828 INT8 pad1;
829 INT8 pad2;
830 };
831
832 struct det_torps_cpacket {
833 INT8 type; /* CP_DET_TORPS */
834 INT8 pad1;
835 INT8 pad2;
836 INT8 pad3;
837 };
838
839 struct det_mytorp_cpacket {
840 INT8 type; /* CP_DET_MYTORP */
841 INT8 pad1;
842 INT16 tnum;
843 };
844
845 struct copilot_cpacket {
846 INT8 type; /* CP_COPLIOT */
847 INT8 state;
848 INT8 pad1;
849 INT8 pad2;
850 };
851
852 struct refit_cpacket {
853 INT8 type; /* CP_REFIT */
854 INT8 ship;
855 INT8 pad1;
856 INT8 pad2;
857 };
858
859 struct tractor_cpacket {
860 INT8 type; /* CP_TRACTOR */
861 INT8 state;
862 INT8 pnum;
863 INT8 pad2;
864 };
865
866 struct repress_cpacket {
867 INT8 type; /* CP_REPRESS */
868 INT8 state;
869 INT8 pnum;
870 INT8 pad2;
871 };
872
873 struct coup_cpacket {
874 INT8 type; /* CP_COUP */
875 INT8 pad1;
876 INT8 pad2;
877 INT8 pad3;
878 };
879
880 struct socket_cpacket {
881 INT8 type; /* CP_SOCKET */
882 INT8 version;
883 INT8 udp_version; /* was pad2 */
884 INT8 pad3;
885 CARD32 socket;
886 };
887
888 struct options_cpacket {
889 INT8 type; /* CP_OPTIONS */
890 INT8 pad1;
891 INT8 pad2;
892 INT8 pad3;
893 CARD32 flags;
894 INT8 keymap[96];
895 };
896
897 struct bye_cpacket {
898 INT8 type; /* CP_BYE */
899 INT8 pad1;
900 INT8 pad2;
901 INT8 pad3;
902 };
903
904 struct dockperm_cpacket {
905 INT8 type; /* CP_DOCKPERM */
906 INT8 state;
907 INT8 pad2;
908 INT8 pad3;
909 };
910
911 struct updates_cpacket {
912 INT8 type; /* CP_UPDATES */
913 INT8 pad1;
914 INT8 pad2;
915 INT8 pad3;
916 CARD32 usecs;
917 };
918
919 struct resetstats_cpacket {
920 INT8 type; /* CP_RESETSTATS */
921 INT8 verify; /* 'Y' - just to make sure he meant it */
922 INT8 pad2;
923 INT8 pad3;
924 };
925
926 struct reserved_cpacket {
927 INT8 type; /* CP_RESERVED */
928 INT8 pad1;
929 INT8 pad2;
930 INT8 pad3;
931 INT8 data[16];
932 INT8 resp[16];
933 };
934
935 struct scan_cpacket { /* ATM */
936 INT8 type; /* CP_SCAN */
937 INT8 pnum;
938 INT8 pad1;
939 INT8 pad2;
940 };
941
942 struct udp_req_cpacket { /* UDP */
943 INT8 type; /* CP_UDP_REQ */
944 INT8 request;
945 INT8 connmode; /* respond with port # or just send UDP
946 packet? */
947 INT8 pad2;
948 INT32 port; /* compensate for hosed recvfrom() */
949 };
950
951 struct sequence_cpacket { /* UDP */
952 INT8 type; /* CP_SEQUENCE */
953 INT8 pad1;
954 CARD16 sequence;
955 };
956
957 struct rsa_key_cpacket {
958 INT8 type; /* CP_RSA_KEY */
959 INT8 pad1;
960 INT8 pad2;
961 INT8 pad3;
962 CARD8 global[KEY_SIZE];
963 CARD8 public[KEY_SIZE];
964 CARD8 resp[KEY_SIZE];
965 };
966
967 /* the CP_ASK_MOTD packet is the same as temp_spacket */
968
969 struct ping_cpacket {
970 INT8 type; /* CP_PING_RESPONSE */
971 CARD8 number; /* id */
972 INT8 pingme; /* if client wants server to ping */
973 INT8 pad1;
974
975 INT32 cp_sent; /* # packets sent to server */
976 INT32 cp_recv; /* # packets recv from server */
977 };
978
979
980 #ifdef FEATURE
981 /* feature_cpacket and _spacket are identical! */
982 struct feature_cpacket { /* CP_FEATURE */
983 INT8 type;
984 char feature_type; /* either 'C' or 'S' */
985 CARD8 arg1; /* could be INT8 depending on feature */
986 CARD8 arg2; /* but only BEEP_LITE uses it, for now */
987 INT32 value;
988 char name[80];
989 };
990
991 struct feature_spacket { /* SP_FEATURE */
992 INT8 type;
993 char feature_type; /* either 'C' or 'S' */
994 CARD8 arg1;
995 CARD8 arg2;
996 INT32 value;
997 char name[80];
998 };
999 #endif /* FEATURE */
1000
1001 /*
1002 * short stuff
1003 */
1004
1005 #ifdef SHORT_PACKETS
1006 struct shortreq_cpacket { /* CP_S_REQ */
1007 INT8 type;
1008 INT8 req;
1009 INT8 version;
1010 INT8 pad2;
1011 };
1012
1013 struct threshold_cpacket { /* CP_S_THRS */
1014 INT8 type;
1015 INT8 pad1;
1016 CARD16 thresh;
1017 };
1018
1019 struct shortreply_spacket { /* SP_S_REPLY */
1020 INT8 type;
1021 INT8 repl;
1022 CARD16 winside;
1023 INT32 gwidth;
1024 };
1025
1026 struct youshort_spacket { /* SP_S_YOU */
1027 INT8 type;
1028
1029 INT8 pnum;
1030 INT8 hostile;
1031 INT8 swar;
1032
1033 INT8 armies;
1034 INT8 whydead;
1035 INT8 whodead;
1036
1037 INT8 pad1;
1038
1039 CARD32 flags;
1040 };
1041
1042 struct youss_spacket { /* SP_S_YOU_SS */
1043 INT8 type;
1044 INT8 pad1;
1045
1046 CARD16 damage;
1047 CARD16 shield;
1048 CARD16 fuel;
1049 CARD16 etemp;
1050 CARD16 wtemp;
1051 };
1052
1053 #define VPLANET_SIZE 6
1054
1055 struct planet_s_spacket { /* body of SP_S_PLANET */
1056 INT8 pnum;
1057 INT8 owner;
1058 INT8 info;
1059 CARD8 armies; /* more than 255 Armies ? ... */
1060 INT16 flags;
1061 };
1062 struct warning_s_spacket { /* SP_S_WARNING */
1063 INT8 type;
1064 CARD8 whichmessage;
1065 INT8 argument, argument2;/* for phaser etc ... */
1066 };
1067
1068 struct player_s_spacket {
1069 INT8 type; /* SP_S_PLAYER Header */
1070 INT8 packets; /* How many player-packets are in this packet
1071 ( only the first 6 bits are relevant ) */
1072 CARD8 dir;
1073 INT8 speed;
1074 INT32 x, y; /* To get the absolute Position */
1075 };
1076
1077 /* The format of the body:
1078 struct player_s_body_spacket { Body of new Player Packet
1079 CARD8 pnum; 0-4 = pnum, 5 local or galactic, 6 = 9. x-bit, 7 9. y-bit
1080 CARD8 speeddir; 0-3 = speed , 4-7 direction of ship
1081 CARD8 x; low 8 bits from X-Pixelcoordinate
1082 CARD8 y; low 8 bits from Y-Pixelcoordinate
1083 };
1084 */
1085
1086 struct torp_s_spacket {
1087 INT8 type; /* SP_S_TORP */
1088 CARD8 bitset; /* bit=1 that torp is in packet */
1089 CARD8 whichtorps; /* Torpnumber of first torp / 8 */
1090 CARD8 data[21]; /* For every torp 2*9 bit coordinates */
1091 };
1092
1093 struct mesg_s_spacket {
1094 INT8 type; /* SP_S_MESSAGE */
1095 CARD8 m_flags;
1096 CARD8 m_recpt;
1097 CARD8 m_from;
1098 CARD8 length; /* Length of whole packet */
1099 INT8 mesg;
1100 INT8 pad2;
1101 INT8 pad3;
1102 INT8 pad[76];
1103 };
1104
1105 struct mesg_s_cpacket {
1106 INT8 type; /* CP_S__MESSAGE */
1107 INT8 group;
1108 INT8 indiv;
1109 INT8 length; /* Size of whole packet */
1110 INT8 mesg[80];
1111 };
1112
1113 #endif
1114
1115 #endif