#include <stdio.h>
#include <stdlib.h>
#include "q3huff.h"



int main(void) {
    unsigned char  packet[] =
"\xff\xff\xff\xff" "connect \"\\challenge\\123\\qport\\456\\protocol\\68\\cl_guid\\0123456789ABCDEF0123456789ABCDEF\\cl_punkbuster\\0\\cg_predictItems\\1\\cl_anonymous\\0\\sex\\male\\handicap\\100\\color2\\5\\color1\\1\\team_headmodel\\doom/blue\\team_model\\doom/blue\\headmodel\\doom/blue\\model\\doom/blue\\snaps\\20\\rate\\25000\\name\\TEST\\cg_smoothClients\\0\\cg_scorePlums\\1\\teamtask\\0\\teamoverlay\\1\"";
    int     len;

    len = Huff_CompressPacket(
        packet,             // data to compress
        12,                 // offset from which starting the compression
        sizeof(packet) - 1  // size of the data to compress
    );

    len = Huff_DecompressPacket(
        packet,             // data to decompress
        12,                 // offset from which starting the decompression
        len,                // size of the data to decompress
        sizeof(packet) - 1  // maximum size of the decompressed data
    );

    printf("\n"
        "The packet has been compressed and then decompressed:\n"
        "\n"
        "%s\n"
        "\n",
        packet);
    return(0);
}


