Information Packet

From WinBolo

Jump to: navigation, search

An information packet provides an overview of the current game. It is sent to the Tracker periodically and is the first message sent when a game is joined.

The LAN broadcast search functionality broadcasts an Information Packet request across the subnet to find games.

typedef struct {
  u_char c[36];
} u_char36;
typedef u_char  BYTE;
typedef u_short WORD;

/* Version */
#define BoloVersion_Major    0x01
#define BoloVersion_Minor    0x01
#define BoloVersion_Revision 0x04

/* Request/Response packets */
#define BoloPacket_Request   13
#define BoloPacket_Response  14

typedef struct {
  BYTE signature[4];      /* 'Bolo' */
  BYTE versionMajor;      /* 0x01   */
  BYTE versionMinor;      /* 0x00   */
  BYTE versionRevision;   /* 0x09   */
  BYTE type;              /* 13 for request, 14 for response */
} BOLOHEADER;

typedef struct {
  struct in_addr serveraddress;
  unsigned short serverport;
  u_long start_time;
  BYTE spare1;
  BYTE spare2;
} GAMEID;

typedef struct {
  BOLOHEADER h;

  u_char36 mapname;    /* Pascal string (first byte is length)         */
  GAMEID gameid;       /* 8 byte unique ID for game (combination       */
                       /* of starting machine address & timestamp)     */
  BYTE gametype;       /* Game type (1, 2 or 3: open, tourn. & strict) */
  BYTE allow_mines;    /* 0x80 for normal hidden mines                 */
                       /* 0xC0 for all mines visible                   */
  BYTE allow_AI;       /* 0 for no AI tanks, 1 for AI tanks allowed    */
  BYTE spare1;         /* 0                                            */
  long start_delay;    /* if non zero, time until game starts, (50ths) */
  long time_limit;     /* if non zero, time until game ends, (50ths)   */

  WORD num_players;    /* number of players                            */
  WORD free_pills;     /* number of free (neutral) pillboxes           */
  WORD free_bases;     /* number of free (neutral) refuelling bases    */
  BYTE has_password;   /* non-zero if game has password set            */
  BYTE spare2;         /* 0                                            */
} INFO_PACKET;

/* Sends a query packet to the command line argument specified */
static void sendquery(int s, char **argv) {
  static const BOLOHEADER h = {  /* Bolo request packet we are sending */
                { 'B', 'o', 'l', 'o' },
    BoloVersion_Major,
    BoloVersion_Minor,
    BoloVersion_Revision,
    BoloPacket_Request
  };
Personal tools