@@ -69,7 +69,9 @@ static dtls_context_t *orig_dtls_context = NULL;
6969static const dtls_cipher_t * ciphers = NULL ;
7070static unsigned int force_extended_master_secret = 0 ;
7171static unsigned int force_renegotiation_info = 0 ;
72-
72+ #if (DTLS_MAX_CID_LENGTH > 0 )
73+ static unsigned int support_cid = 0 ;
74+ #endif
7375
7476#ifdef DTLS_ECC
7577static const unsigned char ecdsa_priv_key [] = {
@@ -246,6 +248,9 @@ get_user_parameters(struct dtls_context_t *ctx,
246248 (void ) session ;
247249 user_parameters -> force_extended_master_secret = force_extended_master_secret ;
248250 user_parameters -> force_renegotiation_info = force_renegotiation_info ;
251+ #if (DTLS_MAX_CID_LENGTH > 0 )
252+ user_parameters -> support_cid = support_cid ;
253+ #endif
249254 if (ciphers ) {
250255 int i = 0 ;
251256 while (i < DTLS_MAX_CIPHER_SUITES ) {
@@ -360,13 +365,18 @@ usage( const char *program, const char *version) {
360365
361366 fprintf (stderr , "%s v%s -- DTLS client implementation\n"
362367 "(c) 2011-2014 Olaf Bergmann <bergmann@tzi.org>\n\n"
368+ "usage: %s [-c cipher suites] [-e] "
363369#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" ,
370+ "[-i file] [-k file] [-o file]\n"
371+ " %*s [-p port] [-r] [-v num]"
366372#else /* DTLS_PSK */
367- "usage: %s [-c cipher suites] [-e] [-o file] [-p port] [-r]\n"
368- " %*s [-v num] addr [port]\n" ,
373+ "[-o file] [-p port] [-r]\n"
374+ " %*s [-v num]"
369375#endif /* DTLS_PSK */
376+ #if (DTLS_MAX_CID_LENGTH > 0 )
377+ " [- z ]"
378+ #endif /* DTLS_MAX_CID_LENGTH > 0*/
379+ " addr [port]\n" ,
370380 program , version , program , (int )strlen (program ), "" );
371381 cipher_suites_usage (stderr , "\t" );
372382 fprintf (stderr , "\t-e\t\tforce extended master secret (RFC7627)\n"
@@ -378,7 +388,10 @@ usage( const char *program, const char *version) {
378388 "\t \t\t(use '-' for STDOUT)\n"
379389 "\t-p port\t\tlisten on specified port (default is %d)\n"
380390 "\t-r\t\tforce renegotiation info (RFC5746)\n"
381- "\t-v num\t\tverbosity level (default: 3)\n" ,
391+ "\t-v num\t\tverbosity level (default: 3)\n"
392+ #if (DTLS_MAX_CID_LENGTH > 0 )
393+ "\t - z \t \tsupport CID (RFC9146 )\n ",
394+ #endif /* DTLS_MAX_CID_LENGTH > 0*/
382395 DEFAULT_PORT );
383396}
384397
@@ -434,7 +447,7 @@ main(int argc, char **argv) {
434447 memcpy (psk_key , PSK_DEFAULT_KEY , psk_key_length );
435448#endif /* DTLS_PSK */
436449
437- while ((opt = getopt (argc , argv , "c:eo:p:rv:" PSK_OPTIONS )) != -1 ) {
450+ while ((opt = getopt (argc , argv , "c:eo:p:rv:z " PSK_OPTIONS )) != -1 ) {
438451 switch (opt ) {
439452#ifdef DTLS_PSK
440453 case 'i' :
@@ -482,6 +495,9 @@ main(int argc, char **argv) {
482495 case 'v' :
483496 log_level = strtol (optarg , NULL , 10 );
484497 break ;
498+ case 'z' :
499+ support_cid = 1 ;
500+ break ;
485501 default :
486502 usage (argv [0 ], dtls_package_version ());
487503 exit (1 );
0 commit comments