]> git.mxchange.org Git - flightgear.git/blob - src/MultiPlayer/mpmessages.hxx
Various mods to allow querying for nearest airport (with optional ability to
[flightgear.git] / src / MultiPlayer / mpmessages.hxx
1 // mpmessages.hxx -- Message definitions for multiplayer communications
2 // within a multiplayer Flightgear
3 //
4 // Written by Duncan McCreanor, started February 2003.
5 // duncan.mccreanor@airservicesaustralia.com
6 //
7 // Copyright (C) 2003  Airservices Australia
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of the
12 // License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 // General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 //
23
24 #ifndef MPMESSAGES_H
25 #define MPMESSAGES_H
26
27 #define MPMESSAGES_HID "$Id$"
28
29 /****************************************************************
30 * @version $Id$
31 *
32 * Description: Each message used for multiplayer communications
33 * consists of a header and optionally a block of data. The combined
34 * header and data is sent as one IP packet.
35 *
36 ******************************************************************/
37
38 #include <plib/sg.h>
39
40 // Message identifiers
41 #define CHAT_MSG_ID 1
42 #define POS_DATA_ID 2
43
44 #define MAX_CALLSIGN_LEN 10
45 /** Header for use with all messages sent */
46 typedef struct {
47
48     /** Message identifier */
49     char MsgId;
50
51     /** Length of the message inclusive of this header */
52     unsigned int iMsgLen;
53
54     /** IP address for reply to message (player's receiver address) */
55     unsigned long int lReplyAddress;
56
57     /** Port for replies (player's receiver port) */
58     unsigned int iReplyPort;
59
60     /** Callsign used by the player */
61     char sCallsign[MAX_CALLSIGN_LEN];
62
63 } T_MsgHdr;
64
65 #define MAX_CHAT_MSG_LEN 50
66 /** Chat message */
67 typedef struct {
68
69     /** Text of chat message */
70     char sText[MAX_CHAT_MSG_LEN];
71
72 } T_ChatMsg;
73
74
75 #define MAX_MODEL_NAME_LEN 50
76 /** Aircraft position message */
77 typedef struct {
78
79     /** Name of the aircraft model */
80     char sModel[MAX_MODEL_NAME_LEN];
81
82     /** Position data for the aircraft */
83     sgMat4 PlayerPos;
84
85 } T_PositionMsg;
86
87
88
89 #endif
90
91