Skip to content

Commit f5e0ca7

Browse files
committed
dtls-client.c: add support_cid option.
Signed-off-by: Achim Kraus <achim.kraus@cloudcoap.net>
1 parent 7cf7699 commit f5e0ca7

1 file changed

Lines changed: 23 additions & 4 deletions

File tree

tests/dtls-client.c

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ static dtls_context_t *orig_dtls_context = NULL;
6969
static const dtls_cipher_t* ciphers = NULL;
7070
static unsigned int force_extended_master_secret = 0;
7171
static unsigned int force_renegotiation_info = 0;
72+
#if (DTLS_MAX_CID_LENGTH > 0)
73+
static unsigned int support_cid = 0;
74+
#endif
7275

7376
static volatile int quit = 0;
7477

@@ -248,6 +251,9 @@ get_user_parameters(struct dtls_context_t *ctx,
248251
(void) session;
249252
user_parameters->force_extended_master_secret = force_extended_master_secret;
250253
user_parameters->force_renegotiation_info = force_renegotiation_info;
254+
#if (DTLS_MAX_CID_LENGTH > 0)
255+
user_parameters->support_cid = support_cid;
256+
#endif
251257
if (ciphers) {
252258
int i = 0;
253259
while (i < DTLS_MAX_CIPHER_SUITES) {
@@ -360,13 +366,18 @@ usage( const char *program, const char *version) {
360366

361367
fprintf(stderr, "%s v%s -- DTLS client implementation\n"
362368
"(c) 2011-2024 Olaf Bergmann <bergmann@tzi.org>\n\n"
369+
"usage: %s [-c cipher suites] [-e] "
363370
#ifdef DTLS_PSK
364-
"usage: %s [-c cipher suites] [-e] [-i file] [-k file] [-o file]\n"
365-
" %*s [-p port] [-r] [-v num] addr [port]\n",
371+
"[-i file] [-k file] [-o file]\n"
372+
" %*s [-p port] [-r] [-v num]"
366373
#else /* DTLS_PSK */
367-
"usage: %s [-c cipher suites] [-e] [-o file] [-p port] [-r]\n"
368-
" %*s [-v num] addr [port]\n",
374+
"[-o file] [-p port] [-r]\n"
375+
" %*s [-v num]"
369376
#endif /* DTLS_PSK */
377+
#if (DTLS_MAX_CID_LENGTH > 0)
378+
" [-z]"
379+
#endif /* DTLS_MAX_CID_LENGTH > 0*/
380+
" addr [port]\n",
370381
program, version, program, (int)strlen(program), "");
371382
cipher_suites_usage(stderr, "\t");
372383
fprintf(stderr, "\t-e\t\tforce extended master secret (RFC7627)\n"
@@ -380,6 +391,9 @@ usage( const char *program, const char *version) {
380391
"\t \t\t(default is an ephemeral free port).\n"
381392
"\t-r\t\tforce renegotiation info (RFC5746)\n"
382393
"\t-v num\t\tverbosity level (default: 3)\n"
394+
#if (DTLS_MAX_CID_LENGTH > 0)
395+
"\t-z\t\tsupport CID (RFC9146)\n"
396+
#endif /* DTLS_MAX_CID_LENGTH > 0*/
383397
"\tDefault destination port: %d\n",
384398
DEFAULT_PORT);
385399
}
@@ -486,6 +500,11 @@ main(int argc, char **argv) {
486500
case 'v' :
487501
log_level = strtol(optarg, NULL, 10);
488502
break;
503+
#if (DTLS_MAX_CID_LENGTH > 0)
504+
case 'z' :
505+
support_cid = 1;
506+
break;
507+
#endif /* DTLS_MAX_CID_LENGTH > 0*/
489508
case -1 :
490509
/* handle arguments */
491510
if (!dst.size) {

0 commit comments

Comments
 (0)