#include "event.h"

#define MAX_HANDLERS 256
static PacketHandler g_handlers[MAX_HANDLERS] = {0};

void register_handler(uint8_t type, PacketHandler handler) {
    g_handlers[type] = handler;
}

void handle_packet(Packet* pkt, SOCKET client) {
    if (g_handlers[pkt->type]) {
        g_handlers[pkt->type](pkt, client);
    }
}
