// // Created by Ajurna on 28/07/2025. // #ifndef SERVER02_H #define SERVER02_H #include #endif //SERVER02_H #include typedef struct handleArgs { int connection; SOCKET client; } handle_args_t; typedef enum MessageType { QUERY = 'Q', INSERT = 'I' } message_type_t; typedef struct Insert { char type; int32_t timestamp; int32_t price; } insert_t; typedef struct Query { char type; int32_t mintime; int32_t maxtime; } query_t; typedef union QueryOrInsert { query_t query; insert_t insert; } query_or_insert_t; typedef struct Price { int32_t timestamp; int32_t price; } price_t; typedef struct PriceArray { size_t size; size_t capacity; price_t *data; } price_array_t; void *handle_connection(void *args); query_or_insert_t *fix_message(const uint8_t *message); price_array_t *price_array_create(int capacity); void price_array_free(price_array_t *array); void price_array_append(price_array_t *array, insert_t *value); int price_array_query(price_array_t *array, query_t *query);