comparison src/packets.h @ 4:aa38447a4b21

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