70 lines
1.2 KiB
C
70 lines
1.2 KiB
C
//
|
|
// Created by Ajurna on 01/08/2025.
|
|
//
|
|
|
|
#ifndef SERVER06_H
|
|
#define SERVER06_H
|
|
#include <stdint.h>
|
|
#include <winsock2.h>
|
|
|
|
#endif //SERVER06_H
|
|
|
|
typedef struct handleArgs {
|
|
int connection;
|
|
SOCKET client;
|
|
}handle_args_t;
|
|
|
|
typedef enum ConnectionType {
|
|
UNKNOWN,
|
|
CAMERA,
|
|
DISPATCHER,
|
|
} connection_type_t;
|
|
|
|
typedef enum MessageType {
|
|
ERROR_MSG = 0x10,
|
|
PLATE_MSG = 0x20,
|
|
TICKET_MSG = 0x21,
|
|
WANT_HEARTBEAT_MSG = 0x40,
|
|
HEARTBEAT_MSG = 0x41,
|
|
I_AM_CAMERA_MSG = 0x80,
|
|
I_AM_DISPATCHER_MSG = 0x81,
|
|
}message_type_t;
|
|
|
|
typedef struct ErrorMsg {
|
|
char *message;
|
|
} error_msg_t;
|
|
|
|
typedef struct PlateMsg {
|
|
char *plate;
|
|
uint32_t timestamp;
|
|
} plate_msg_t;
|
|
|
|
typedef struct TicketMsg {
|
|
char *plate;
|
|
uint16_t road;
|
|
uint16_t mile1;
|
|
uint32_t timestamp1;
|
|
uint16_t mile2;
|
|
uint32_t timestamp2;
|
|
uint16_t speed;
|
|
} ticket_msg_t;
|
|
|
|
typedef struct WantHeartbeatMsg {
|
|
uint32_t timestamp;
|
|
} want_heartbeat_msg_t;
|
|
|
|
typedef struct HeartbeatMsg {
|
|
|
|
} heartbeat_msg_t;
|
|
|
|
typedef struct IAmCameraMsg {
|
|
uint16_t road;
|
|
uint16_t mile;
|
|
uint16_t limit;
|
|
} i_am_camera_msg_t;
|
|
|
|
typedef struct IAmDispatcherMsg {
|
|
uint16_t *road;
|
|
} i_am_dispatcher_msg_t;
|
|
|
|
void *handle_connection(void *args); |