Skip to content

Commit 854aa8b

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

1 file changed

Lines changed: 23 additions & 7 deletions

File tree

tests/dtls-client.c

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ static dtls_context_t *orig_dtls_context = NULL;
6363
static const dtls_cipher_t* ciphers = NULL;
6464
static unsigned int force_extended_master_secret = 0;
6565
static unsigned int force_renegotiation_info = 0;
66-
66+
#if (DTLS_MAX_CID_LENGTH > 0)
67+
static unsigned int support_cid = 0;
68+
#endif
6769

6870
#ifdef DTLS_ECC
6971
static const unsigned char ecdsa_priv_key[] = {
@@ -240,6 +242,9 @@ get_user_parameters(struct dtls_context_t *ctx,
240242
(void) session;
241243
user_parameters->force_extended_master_secret = force_extended_master_secret;
242244
user_parameters->force_renegotiation_info = force_renegotiation_info;
245+
#if (DTLS_MAX_CID_LENGTH > 0)
246+
user_parameters->support_cid = support_cid;
247+
#endif
243248
if (ciphers) {
244249
int index = 0;
245250
while (index < DTLS_MAX_CIPHER_SUITES) {
@@ -354,13 +359,18 @@ usage( const char *program, const char *version) {
354359

355360
fprintf(stderr, "%s v%s -- DTLS client implementation\n"
356361
"(c) 2011-2014 Olaf Bergmann <bergmann@tzi.org>\n\n"
362+
"usage: %s [-c cipher suites] [-e] "
357363
#ifdef DTLS_PSK
358-
"usage: %s [-c cipher suites] [-e] [-i file] [-k file] [-o file]\n"
359-
" %*s [-p port] [-r] [-v num] addr [port]\n",
364+
"[-i file] [-k file] [-o file]\n"
365+
" %*s [-p port] [-r] [-v num]"
360366
#else /* DTLS_PSK */
361-
"usage: %s [-c cipher suites] [-e] [-o file] [-p port] [-r]\n"
362-
" %*s [-v num] addr [port]\n",
367+
"[-o file] [-p port] [-r]\n"
368+
" %*s [-v num]"
363369
#endif /* DTLS_PSK */
370+
#if (DTLS_MAX_CID_LENGTH > 0)
371+
" [-z]"
372+
#endif /* DTLS_MAX_CID_LENGTH > 0*/
373+
" addr [port]\n",
364374
program, version, program, (int)strlen(program), "");
365375
cipher_suites_usage(stderr, "\t");
366376
fprintf(stderr, "\t-e\t\tforce extended master secret (RFC7627)\n"
@@ -372,7 +382,10 @@ usage( const char *program, const char *version) {
372382
"\t \t\t(use '-' for STDOUT)\n"
373383
"\t-p port\t\tlisten on specified port (default is %d)\n"
374384
"\t-r\t\tforce renegotiation info (RFC5746)\n"
375-
"\t-v num\t\tverbosity level (default: 3)\n",
385+
"\t-v num\t\tverbosity level (default: 3)\n"
386+
#if (DTLS_MAX_CID_LENGTH > 0)
387+
"\t-z\t\tsupport CID (RFC9146)\n",
388+
#endif /* DTLS_MAX_CID_LENGTH > 0*/
376389
DEFAULT_PORT);
377390
}
378391

@@ -428,7 +441,7 @@ main(int argc, char **argv) {
428441
memcpy(psk_key, PSK_DEFAULT_KEY, psk_key_length);
429442
#endif /* DTLS_PSK */
430443

431-
while ((opt = getopt(argc, argv, "c:eo:p:rv:" PSK_OPTIONS)) != -1) {
444+
while ((opt = getopt(argc, argv, "c:eo:p:rv:z" PSK_OPTIONS)) != -1) {
432445
switch (opt) {
433446
#ifdef DTLS_PSK
434447
case 'i' :
@@ -476,6 +489,9 @@ main(int argc, char **argv) {
476489
case 'v' :
477490
log_level = strtol(optarg, NULL, 10);
478491
break;
492+
case 'z' :
493+
support_cid = 1;
494+
break;
479495
default:
480496
usage(argv[0], dtls_package_version());
481497
exit(1);

0 commit comments

Comments
 (0)