1/* Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc.  See LICENSE. */
2#include <assert.h>
3#include <stdio.h>
4#include <stdlib.h>
5#include <string.h>
6#include <sys/queue.h>
7
8#include "lsquic.h"
9#include "lsquic_int_types.h"
10#include "lsquic_hash.h"
11#include "lsquic_conn.h"
12
13#include "lsquic_qlog.h"
14
15#define LSQUIC_LOGGER_MODULE LSQLM_NOMODULE
16#include "lsquic_logger.h"
17
18
19int
20main (void)
21{
22    lsquic_global_init(LSQUIC_GLOBAL_CLIENT | LSQUIC_GLOBAL_CLIENT);
23    lsquic_log_to_fstream(stderr, LLTS_HHMMSSMS);
24    lsquic_set_log_level("debug");
25
26    lsquic_qlog_create_connection(0, NULL, NULL);
27    struct in_addr local_addr = {.s_addr = htonl(0x0a000001),};
28    struct sockaddr_in local =
29    {
30        .sin_family = AF_INET,
31        .sin_port = htons(12345),
32        .sin_addr = local_addr,
33    };
34    struct in_addr peer_addr = {.s_addr = htonl(0x0a000002),};
35    struct sockaddr_in peer =
36    {
37        .sin_family = AF_INET,
38        .sin_port = htons(443),
39        .sin_addr = peer_addr,
40    };
41    lsquic_cid_t cid;   memset(&cid, 0, sizeof(cid));
42    lsquic_qlog_create_connection(&cid, (const struct sockaddr *)&local,
43                                        (const struct sockaddr *)&peer);
44
45    lsquic_qlog_packet_rx(&cid, NULL, NULL, 0);
46    lsquic_qlog_hsk_completed(&cid);
47    lsquic_qlog_sess_resume(&cid);
48    lsquic_qlog_check_certs(&cid, NULL, 0);
49
50    lsquic_qlog_version_negotiation(&cid, NULL, NULL);
51    lsquic_qlog_version_negotiation(&cid, "proposed", NULL);
52    lsquic_qlog_version_negotiation(&cid, "proposed", "Q035");
53    lsquic_qlog_version_negotiation(&cid, "proposed", "Q046");
54    lsquic_qlog_version_negotiation(&cid, "agreed", "Q044");
55    lsquic_qlog_version_negotiation(&cid, "agreed", "Q098");
56    lsquic_qlog_version_negotiation(&cid, "something else", "Q098");
57    return 0;
58}
59