test_chlo_gen.c revision 9a690580
1/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */ 2/* 3 * test_chlo_gen.c -- Test Client Hello generation. 4 */ 5 6#include <assert.h> 7#include <stdlib.h> 8#include <unistd.h> 9 10#include <openssl/bio.h> 11 12#include "lsquic.h" 13#include "lsquic_hsk_cli_ietf.h" 14#include "lsquic_logger.h" 15 16 17static int 18my_bwrite (BIO *bio, const char *buf, int len) 19{ 20 return 0; 21} 22 23static int 24my_bread (BIO *bio, char *buf, int len) 25{ 26 return 0; 27} 28 29static const BIO_METHOD bio_method = { 30 .type = 0, /* XXX ? */ 31 .name = __FILE__, 32 .bwrite = my_bwrite, 33 .bread = my_bread, 34}; 35 36int 37main (int argc, char **argv) 38{ 39 int opt, s; 40 41 lsquic_log_to_fstream(stderr, LLTS_NONE); 42 43 while (-1 != (opt = getopt(argc, argv, "l:L:"))) 44 { 45 switch (opt) 46 { 47 case 'l': 48 lsquic_logger_lopt(optarg); 49 break; 50 case 'L': 51 lsquic_set_log_level(optarg); 52 break; 53 default: 54 exit(EXIT_FAILURE); 55 } 56 } 57 58 const lsquic_cid_t dcid = { .len = 10, .idbuf = "wild thing", }; 59 struct hsk_cli *cli = lsquic_hsk_cli_new(&dcid, &bio_method, NULL, 60 (unsigned char *) "some params", 11); 61 62 assert(cli); 63 s = lsquic_hsk_cli_write(cli); 64 assert(0 == s); 65 66 (void) 67 lsquic_hsk_cli_write(cli); 68 69 lsquic_hsk_cli_destroy(cli); 70 71 exit(EXIT_SUCCESS); 72} 73