test_tokgen.c revision a74702c6
1/* Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc.  See LICENSE. */
2#include <assert.h>
3#include <stdio.h>
4#include <string.h>
5#include <sys/queue.h>
6
7#include "lsquic.h"
8#include "lsquic_types.h"
9#include "lsquic_int_types.h"
10#include "lsquic_mm.h"
11#include "lsquic_tokgen.h"
12#include "lsquic_stock_shi.h"
13#include "lsquic_engine_public.h"
14
15int
16main (int argc, char **argv)
17{
18    struct lsquic_engine_public enpub = {
19        .enp_shi_ctx = lsquic_stock_shared_hash_new(),
20        .enp_shi = &stock_shi,
21    };
22    struct token_generator *tg;
23    unsigned char token[16];
24    unsigned i;
25    lsquic_cid_t cid;
26
27    memset(&cid, 0, sizeof(cid));
28    cid.len = 8;
29
30    tg = lsquic_tg_new(&enpub);
31
32    lsquic_tg_generate_sreset(tg, &cid, token);
33    for (i = 0; i < sizeof(token); ++i)
34        printf("%02X", token[i]);
35    printf("\n");
36
37    lsquic_tg_destroy(tg);
38
39    return 0;
40}
41