Skip to content

Message Handlers

Jason Watkins edited this page May 12, 2015 · 1 revision

###Types

####MessageHandler A pointer to a function that acts on a given message.

####MessageHandlers Handles incoming messages and manages connections.

#####MessageHandlers Methods

######HandleMessage Signature: static void HandleMessage(Message& msg);

After a message is read, HandleMessage analyzes the sender's network address to determine whether the sender is a new client. It then either loads connection details for an existing client, or creates a new connection record for new clients. Finally, the message handler checks the message type and dispatches the message to the appropriate handler.

######SetSocket Signature: static void SetSocket(UDPSocket* socket);

Sets the socket used to send responses for messages that require them.

######Handle (Command) Signatures:

static void HandleConn(const Message& msg);
static void HandleCtrl(const Message& msg);
static void HandleData(const Message& msg);
static void HandleDref(const Message& msg);
static void HandleGetD(const Message& msg);
static void HandlePosi(const Message& msg);
static void HandleSimu(const Message& msg);
static void HandleText(const Message& msg);
static void HandleWypt(const Message& msg);
static void HandleView(const Message& msg);

Perform command-specific validation and actions.

######HandleXPlaneData Signature: static void HandleXPlaneData(const Message& msg);

Forwards X-Plane UDP commands that do not overlap with the plugin's functionality to X-Plane

######HandleUnknown Signature: static void HandleUnknown(const Message& msg);

Handles messages with unrecognized headers. Currently, the header is logged to a file and the message is otherwise ignored.

####ConnectionInfo Stores information related to a particular client's session.