generated from AfonsoCMSousa/CPP-Template
Feat: Parce END_SESSION and store all connected players information instead of just one
This commit is contained in:
+127
-123
@@ -6,149 +6,153 @@
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
struct handshake {
|
||||
// [not used in the current Remote Telemtry version by AC]
|
||||
// In future versions it will identify the platform type of the client.
|
||||
// This will be used to adjust a specific behaviour for each platform. (eIPadDevice for now (1))
|
||||
int32_t identifier;
|
||||
// [not used in the current Remote Telemtry version by AC]
|
||||
// In future versions it will identify the platform type of the client.
|
||||
// This will be used to adjust a specific behaviour for each platform. (eIPadDevice for now (1))
|
||||
int32_t identifier;
|
||||
|
||||
// [not used in the current Remote Telemtry version by AC]
|
||||
// In future version this field will identify the AC Remote Telemetry version that the device expects to speak with.
|
||||
int32_t version;
|
||||
// [not used in the current Remote Telemtry version by AC]
|
||||
// In future version this field will identify the AC Remote Telemetry version that the device expects to speak with.
|
||||
int32_t version;
|
||||
|
||||
// This is the type of operation required by the client.
|
||||
// The following operations are now available:
|
||||
// ----------------------------------------------------------------
|
||||
// HANDSHAKE = 0 :
|
||||
// This operation identifier must be set when the client wants to start the comunication.
|
||||
//
|
||||
// SUBSCRIBE_UPDATE = 1 :
|
||||
// This operation identifier must be set when the client wants to be updated from the specific ACServer.
|
||||
//
|
||||
// SUBSCRIBE_SPOT = 2 :
|
||||
// This operation identifier must be set when the client wants to be updated from the specific ACServer just for SPOT Events (e.g.: the end of a lap).
|
||||
//
|
||||
// DISMISS = 3 :
|
||||
// This operation identifier must be set when the client wants to leave the comunication with ACServer.
|
||||
int32_t operationId;
|
||||
// This is the type of operation required by the client.
|
||||
// The following operations are now available:
|
||||
// ----------------------------------------------------------------
|
||||
// HANDSHAKE = 0 :
|
||||
// This operation identifier must be set when the client wants to start the comunication.
|
||||
//
|
||||
// SUBSCRIBE_UPDATE = 1 :
|
||||
// This operation identifier must be set when the client wants to be updated from the specific ACServer.
|
||||
//
|
||||
// SUBSCRIBE_SPOT = 2 :
|
||||
// This operation identifier must be set when the client wants to be updated from the specific ACServer just for SPOT Events (e.g.: the end of a lap).
|
||||
//
|
||||
// DISMISS = 3 :
|
||||
// This operation identifier must be set when the client wants to leave the comunication with ACServer.
|
||||
int32_t operationId;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct handshackerResponse{
|
||||
// is the name of the car that the player is driving on the AC Server
|
||||
char carName[50];
|
||||
struct handshackerResponse {
|
||||
// is the name of the car that the player is driving on the AC Server
|
||||
char carName[50];
|
||||
|
||||
// is the name of the driver running on the AC Server
|
||||
char driverName[50];
|
||||
// is the name of the driver running on the AC Server
|
||||
char driverName[50];
|
||||
|
||||
// for now is just 4242, this code will identify different status,
|
||||
// as “NOT AVAILABLE” for connection
|
||||
int32_t identifier;
|
||||
// for now is just 4242, this code will identify different status,
|
||||
// as “NOT AVAILABLE” for connection
|
||||
int32_t identifier;
|
||||
|
||||
// for now is set to 1, this will identify the version running on the AC Server
|
||||
int32_t version;
|
||||
// for now is set to 1, this will identify the version running on the AC Server
|
||||
int32_t version;
|
||||
|
||||
// is the name of the track on the AC Server
|
||||
char trackName[50];
|
||||
// is the name of the track on the AC Server
|
||||
char trackName[50];
|
||||
|
||||
// is the track configuration on the AC Server
|
||||
char trackConfig[50];
|
||||
// is the track configuration on the AC Server
|
||||
char trackConfig[50];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct postion {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct carAtributes {
|
||||
// Related to ACSP_CAR_INFO
|
||||
u_char isConnected; // 1 = connected, 0 = disconnected
|
||||
char *carModel;
|
||||
char *carSkin;
|
||||
char *driver_name;
|
||||
char *driver_team;
|
||||
char *driver_GUID;
|
||||
// Related to ACSP_CAR_INFO
|
||||
u_char isConnected; // 1 = connected, 0 = disconnected
|
||||
char *car_model;
|
||||
char *car_skin;
|
||||
char *driver_name;
|
||||
char *driver_team;
|
||||
char *driver_GUID;
|
||||
|
||||
// Related to ACSP_CAR_UPDATE
|
||||
u_int8_t carID;
|
||||
postion position;
|
||||
postion velocity;
|
||||
u_int8_t carGear;
|
||||
u_int16_t carRPM;
|
||||
float_t normalizedSplinePos;
|
||||
// Related to ACSP_CAR_UPDATE
|
||||
u_int8_t carID;
|
||||
postion position;
|
||||
postion velocity;
|
||||
u_int8_t carGear;
|
||||
u_int16_t carRPM;
|
||||
float_t normalizedSplinePos;
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
struct trackAtributes {
|
||||
u_int8_t protocol_version;
|
||||
u_int8_t session_index;
|
||||
u_int8_t current_session_index;
|
||||
u_int8_t session_count;
|
||||
|
||||
char *server_name;
|
||||
char *track;
|
||||
char *track_config;
|
||||
char *session_name;
|
||||
|
||||
u_int8_t typ;
|
||||
u_int16_t time;
|
||||
u_int16_t laps;
|
||||
u_int16_t wait_time;
|
||||
u_int8_t ambient_temp;
|
||||
u_int8_t road_temp;
|
||||
|
||||
char *weather_graphics;
|
||||
int32_t elapsed_ms;
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
enum ACSP_MessageType {
|
||||
// ============================
|
||||
// PROTOCOL VERSION
|
||||
// ============================
|
||||
PROTOCOL_VERSION = 4,
|
||||
|
||||
// ============================
|
||||
// SERVER → CLIENT MESSAGES
|
||||
// ============================
|
||||
ACSP_NEW_SESSION = 50,
|
||||
ACSP_NEW_CONNECTION = 51,
|
||||
ACSP_CONNECTION_CLOSED = 52,
|
||||
ACSP_CAR_UPDATE = 53,
|
||||
ACSP_CAR_INFO = 54, // Response to ACSP_GET_CAR_INFO
|
||||
ACSP_END_SESSION = 55,
|
||||
ACSP_VERSION = 56,
|
||||
ACSP_CHAT = 57,
|
||||
ACSP_CLIENT_LOADED = 58,
|
||||
ACSP_SESSION_INFO = 59,
|
||||
ACSP_ERROR = 60,
|
||||
ACSP_LAP_COMPLETED = 73,
|
||||
|
||||
// ============================
|
||||
// EVENTS
|
||||
// ============================
|
||||
ACSP_CLIENT_EVENT = 130,
|
||||
|
||||
// ============================
|
||||
// EVENT TYPES
|
||||
// ============================
|
||||
ACSP_CE_COLLISION_WITH_CAR = 10,
|
||||
ACSP_CE_COLLISION_WITH_ENV = 11,
|
||||
|
||||
// ============================
|
||||
// CLIENT → SERVER COMMANDS
|
||||
// ============================
|
||||
ACSP_REALTIMEPOS_INTERVAL = 200,
|
||||
ACSP_GET_CAR_INFO = 201,
|
||||
ACSP_SEND_CHAT = 202, // Sends chat to one car
|
||||
ACSP_BROADCAST_CHAT = 203, // Sends chat to everybody
|
||||
ACSP_GET_SESSION_INFO = 204,
|
||||
ACSP_SET_SESSION_INFO = 205,
|
||||
ACSP_KICK_USER = 206,
|
||||
ACSP_NEXT_SESSION = 207,
|
||||
ACSP_RESTART_SESSION = 208,
|
||||
ACSP_ADMIN_COMMAND = 209 // Send message plus a string
|
||||
enum SessionType {
|
||||
PRACTICE = 0,
|
||||
RACE = 1,
|
||||
QUALIFYING = 2,
|
||||
};
|
||||
|
||||
struct trackAtributes {
|
||||
u_int8_t protocol_version;
|
||||
u_int8_t session_index;
|
||||
u_int8_t current_session_index;
|
||||
u_int8_t session_count;
|
||||
SessionType session_type;
|
||||
|
||||
char *server_name;
|
||||
char *track;
|
||||
char *track_config;
|
||||
char *session_name;
|
||||
|
||||
u_int8_t typ;
|
||||
u_int16_t time;
|
||||
u_int16_t laps;
|
||||
u_int16_t wait_time;
|
||||
u_int8_t ambient_temp;
|
||||
u_int8_t road_temp;
|
||||
|
||||
char *weather_graphics;
|
||||
int32_t elapsed_ms;
|
||||
} __attribute__((packed));
|
||||
|
||||
enum ACSP_MessageType {
|
||||
// ============================
|
||||
// PROTOCOL VERSION
|
||||
// ============================
|
||||
PROTOCOL_VERSION = 4,
|
||||
|
||||
// ============================
|
||||
// SERVER → CLIENT MESSAGES
|
||||
// ============================
|
||||
ACSP_NEW_SESSION = 50,
|
||||
ACSP_NEW_CONNECTION = 51,
|
||||
ACSP_CONNECTION_CLOSED = 52,
|
||||
ACSP_CAR_UPDATE = 53,
|
||||
ACSP_CAR_INFO = 54, // Response to ACSP_GET_CAR_INFO
|
||||
ACSP_END_SESSION = 55,
|
||||
ACSP_VERSION = 56,
|
||||
ACSP_CHAT = 57,
|
||||
ACSP_CLIENT_LOADED = 58,
|
||||
ACSP_SESSION_INFO = 59,
|
||||
ACSP_ERROR = 60,
|
||||
ACSP_LAP_COMPLETED = 73,
|
||||
|
||||
// ============================
|
||||
// EVENTS
|
||||
// ============================
|
||||
ACSP_CLIENT_EVENT = 130,
|
||||
|
||||
// ============================
|
||||
// EVENT TYPES
|
||||
// ============================
|
||||
ACSP_CE_COLLISION_WITH_CAR = 10,
|
||||
ACSP_CE_COLLISION_WITH_ENV = 11,
|
||||
|
||||
// ============================
|
||||
// CLIENT → SERVER COMMANDS
|
||||
// ============================
|
||||
ACSP_REALTIMEPOS_INTERVAL = 200,
|
||||
ACSP_GET_CAR_INFO = 201,
|
||||
ACSP_SEND_CHAT = 202, // Sends chat to one car
|
||||
ACSP_BROADCAST_CHAT = 203, // Sends chat to everybody
|
||||
ACSP_GET_SESSION_INFO = 204,
|
||||
ACSP_SET_SESSION_INFO = 205,
|
||||
ACSP_KICK_USER = 206,
|
||||
ACSP_NEXT_SESSION = 207,
|
||||
ACSP_RESTART_SESSION = 208,
|
||||
ACSP_ADMIN_COMMAND = 209 // Send message plus a string
|
||||
};
|
||||
|
||||
#endif // SERVER_STRUCTS_H
|
||||
|
||||
Reference in New Issue
Block a user