1a74702c6SGeorge Wang/* Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc.  See LICENSE. */
250aadb33SDmitri Tikhonov#include <assert.h>
350aadb33SDmitri Tikhonov#include <stdlib.h>
43b55e6aeSDmitri Tikhonov#include <string.h>
550aadb33SDmitri Tikhonov
650aadb33SDmitri Tikhonov#include "lsquic.h"
750aadb33SDmitri Tikhonov
850aadb33SDmitri Tikhonov
950aadb33SDmitri Tikhonovint
1050aadb33SDmitri Tikhonovmain (void)
1150aadb33SDmitri Tikhonov{
1250aadb33SDmitri Tikhonov    struct lsquic_engine_settings settings;
1350aadb33SDmitri Tikhonov    lsquic_engine_t *engine;
1450aadb33SDmitri Tikhonov    unsigned versions;
1550aadb33SDmitri Tikhonov    const unsigned flags = LSENG_SERVER;
1650aadb33SDmitri Tikhonov
1750aadb33SDmitri Tikhonov    lsquic_engine_init_settings(&settings, flags);
1850aadb33SDmitri Tikhonov
193b55e6aeSDmitri Tikhonov    struct lsquic_engine_api api;
203b55e6aeSDmitri Tikhonov    memset(&api, 0, sizeof(api));
213b55e6aeSDmitri Tikhonov    api.ea_settings = &settings;
223b55e6aeSDmitri Tikhonov    api.ea_packets_out = (void *) (uintptr_t) 1;
23df25d34aSDmitri Tikhonov    api.ea_stream_if = (void *) (uintptr_t) 2;
2450aadb33SDmitri Tikhonov
2550aadb33SDmitri Tikhonov    engine = lsquic_engine_new(flags, &api);
2650aadb33SDmitri Tikhonov    assert(engine);
2750aadb33SDmitri Tikhonov    versions = lsquic_engine_quic_versions(engine);
2850aadb33SDmitri Tikhonov    assert(versions == settings.es_versions);
2950aadb33SDmitri Tikhonov    lsquic_engine_destroy(engine);
3050aadb33SDmitri Tikhonov
3150aadb33SDmitri Tikhonov    settings.es_versions |= (1 << N_LSQVER /* Invalid value by definition */);
3250aadb33SDmitri Tikhonov    engine = lsquic_engine_new(flags, &api);
3350aadb33SDmitri Tikhonov    assert(!engine);
3450aadb33SDmitri Tikhonov
3550aadb33SDmitri Tikhonov    return 0;
3650aadb33SDmitri Tikhonov}
37