From WinBolo

Jump to: navigation, search

The winbolonet directory contains the code that communicates with WBN using the WBN Protocol.



winbolonet.c is the entry point for code to access Servers use the module the most. Clients only use it to request a client key.

Both clients and servers access the winbolonetDestroy(); function when the application quits.

Server Functions

*NAME:          winbolonetCreateServer
*AUTHOR:        John Morrison
*CREATION DATE: 23/09/01
*LAST MODIFIED: 02/04/02
* Initialises the module. Returns success.
* Tries to contact server to verify versions.
* mapName - Name of the map
* port - Port we are running on
* gameType - Game Type
* ai - Is AI allowed
* mines - Mines allowed
* password - Has password
* numBases - Number of bases
* numPills - Number of pills
* freeBases - Free bases
* freePills - Free pills
* numPlayers -  Number of players in the game
* startTime - Game start time
bool winbolonetCreateServer(char *mapName, unsigned short port, BYTE gameType,
BYTE ai, bool mines, bool password, BYTE numBases, BYTE numPills, BYTE freeBases,
BYTE freePills, BYTE numPlayers, long startTime);

Used to register a server with WBN.

*NAME:          winbolonetAddEvent
*AUTHOR:        John Morrison
*CREATION DATE: 04/04/02
*LAST MODIFIED: 04/04/02
* Adds a Event for sending to the server
*  eventType - Type of event this is
*  isServer  - Are we the server for this and not a client
*  playerA   - Player A player Number
*  playerB   - Player B player Number
void winbolonetAddEvent(BYTE eventType, bool isServer, BYTE playerA, BYTE playerB);

This function is called by a lot of different files in bolo/ every time a game event occurs. e.g. a pillbox is captured. It adds an event to #winbolonetevents.c so that it can be processed by #winbolowinbolonetthread.c.

The list of valid eventTypes's are located in winbolonet.h

Client Functions

Clients make use of the following functions:

*NAME:          winbolonetCreateClient
*AUTHOR:        John Morrison
*CREATION DATE: 31/03/02
*LAST MODIFIED: 31/03/02
* Initialises the module for a client.
* Returns success.
* userName  - account name
* password  - Password for the account
* serverKey - Session key for the server
* errorMsg  - Buffer to hold Error message if required
bool winbolonetCreateClient(char *userName, char *password, BYTE *serverKey, char *errorMsg);


This is a simple linked list class an accessor functions for holding pending WBN events prior to sending them. The underlying list structure is defined as:

typedef struct winboloNetObj *winbolonetEvents;
struct winboloNetObj {
  winbolonetEvents next; /* Next item */
  BYTE itemType;


This file contains the Windows and linux code for creating a new processing thread that periodically (500ms) checks for new pending events that haven't been sent to WBN. This code was placed in a thread so it could run asynchronously as not lock up the server with WBN was to become unavailable or take a long time to respond to requests.


http.c contains the Windows and Linux low level source code for communicating to the WBN server over HTTP. It also provides the log uploading functionality.

Personal tools