1 #ifndef __NET_H
2 #define __NET_H
3 
4 
5 /* packet headers commented out are not used - they're obsolette, packets
6    haven't been renumbered only for some unsure backward compatibility */
7 /* obsolette packets were last used in version 0.6, they're unused since version 0.7 */
8 
9 
10 #define P_NEW_PLAYER 0
11 #define P_PLAYER_ACCEPTED 1
12 #define P_PLAYER_REFUSED 2
13 #define P_END 3
14 #define P_NEW_OBJ 4
15 #define P_UPDATE_STATUS 5
16 #define P_UPDATE_OBJECT 6
17 #define P_QUIT_REQUEST 7
18 #define P_DELETE_OBJECT 8
19 #define P_PLAYER_DELETED 9
20 /* #define P_WALK 10    *
21  * #define P_JUMP 11    *
22  * #define P_SHOOT 12   */
23 #define P_MESSAGE 13
24 #define P_UPDATE_PLAYER 14
25 #define P_HIT 15
26 /* #define P_CHANGE_WEAPON 16  */
27 /* number 17 is unused (historical reasons...) */
28 #define P_KEYBOARD 18
29 #define P_INFO 19
30 #define P_REENTER_GAME 20
31 #define P_CHUNK 21  /* chunk of packets */
32 #define P_UPDATE_OBJECT_POS 22
33 #define P_UPDATE_OBJECT_SPEED 23
34 #define P_UPDATE_OBJECT_COORDS 24
35 #define P_UPDATE_OBJECT_SPEED_STATUS 25
36 #define P_UPDATE_OBJECT_COORDS_STATUS 26
37 #define P_UPDATE_OBJECT_SPEED_STATUS_TTL 27
38 #define P_UPDATE_OBJECT_COORDS_STATUS_TTL 28
39 #define P_EXPLODE_GRENADE 29
40 #define P_BELL 30
41 #define P_CHANGE_LEVEL 31
42 #define P_LEVEL_ACCEPTED 32
43 
44 
45 /* socket filedescriptor */
46 extern int fd;
47 
48 /* send packet with CRC and sender's and recipient's ID */
49 extern void send_packet(unsigned char *packet,int len,const struct sockaddr* addr,int sender,int recipient);
50 /* receive packet with CRC and sender's and recipient's ID */
51 extern int recv_packet(unsigned char *packet,int max_len,struct sockaddr* addr,int *addr_len,int sender,int recipient, int *s);
52 
53 #endif
54