@@ -504,26 +504,25 @@ struct nc_ch_client_thread_arg {
504504
505505struct nc_server_opts {
506506 /* ACCESS locked - hello lock - separate lock to not always hold config_lock */
507+ pthread_rwlock_t hello_lock ; /**< Needs to be held while the server <hello> message is being generated. */
508+
507509 char * * ignored_modules ; /**< Names of YANG modules that are not reported in the server <hello> message. */
508- uint16_t ignored_mod_count ;
510+ uint16_t ignored_mod_count ; /**< Number of ignored modules. */
509511 NC_WD_MODE wd_basic_mode ; /**< With-defaults basic mode of the server. */
510512 int wd_also_supported ; /**< Bitmap of with-defaults modes that are also supported by the server. */
511- char * * capabilities ;
512- uint32_t capabilities_count ;
513+ char * * capabilities ; /**< Array of server's capabilities. */
514+ uint32_t capabilities_count ; /**< Number of server's capabilities. */
513515
514516 char * (* content_id_clb )(void * user_data ); /**< Callback for generating content_id for ietf-yang-library data. */
515- void * content_id_data ;
516- void (* content_id_data_free )(void * data );
517-
518- pthread_rwlock_t hello_lock ; /**< Needs to be held while the server <hello> message is being generated. */
519-
520- /* ACCESS unlocked */
521- uint16_t idle_timeout ;
517+ void * content_id_data ; /**< Data passed to the content_id_clb callback. */
518+ void (* content_id_data_free )(void * data ); /**< Callback to free the content_id_data. */
522519
523520 /* ACCESS locked - options modified by YANG data/API - WRITE lock
524521 * - options read when accepting sessions - READ lock */
525522 pthread_rwlock_t config_lock ;
526523
524+ uint16_t idle_timeout ; /**< Idle timeout of the server sessions. */
525+
527526#ifdef NC_ENABLED_SSH_TLS
528527 char * authkey_path_fmt ; /**< Path to users' public keys that may contain tokens with special meaning. */
529528 char * pam_config_name ; /**< PAM configuration file name. */
@@ -532,112 +531,112 @@ struct nc_server_opts {
532531 void (* interactive_auth_data_free )(void * data );
533532
534533 int (* user_verify_clb )(const struct nc_session * session );
535- #endif /* NC_ENABLED_SSH_TLS */
536534
537- #ifdef NC_ENABLED_SSH_TLS
538- struct nc_keystore keystore ; /**< Server's keys/certificates. */
539- struct nc_truststore truststore ; /**< Server client's keys/certificates. */
535+ struct nc_keystore keystore ; /**< Stored asymmetric and symmetric keys used by the server. */
536+ struct nc_truststore truststore ; /**< Stored certificates and public keys used for authentication. */
540537#endif /* NC_ENABLED_SSH_TLS */
541538
542- /* ACCESS locked */
543- struct nc_bind * binds ;
544- pthread_mutex_t bind_lock ; /**< To avoid concurrent calls of poll and accept on the bound sockets **/
545539 struct nc_endpt {
546- char * name ;
540+ char * name ; /**< Identifier of the endpoint. */
547541#ifdef NC_ENABLED_SSH_TLS
548- char * referenced_endpt_name ;
542+ char * referenced_endpt_name ; /**< Reference to another endpoint (used for client authentication). */
549543#endif /* NC_ENABLED_SSH_TLS */
550- NC_TRANSPORT_IMPL ti ;
551- struct nc_keepalives ka ;
552544
545+ struct nc_keepalives ka ; /**< Keepalives configuration data. */
546+
547+ NC_TRANSPORT_IMPL ti ; /**< Transport implementation of the endpoint. */
553548 union {
554549#ifdef NC_ENABLED_SSH_TLS
555- struct nc_server_ssh_opts * ssh ;
556-
557- struct nc_server_tls_opts * tls ;
550+ struct nc_server_ssh_opts * ssh ; /**< SSH transport options. */
551+ struct nc_server_tls_opts * tls ; /**< TLS transport options. */
558552#endif /* NC_ENABLED_SSH_TLS */
559- struct nc_server_unix_opts * unixsock ;
553+ struct nc_server_unix_opts * unixsock ; /**< UNIX socket transport options. */
560554 } opts ;
561- } * endpts ;
562- uint16_t endpt_count ;
555+ } * endpts ; /**< Array of server's endpoints. */
556+ uint16_t endpt_count ; /**< Number of server's endpoints. */
563557
564558 struct nc_ch_client {
565- char * name ;
559+ char * name ; /**< Identifier of the Call Home client. */
566560 pthread_t tid ; /**< Call Home client's thread ID */
567561 struct nc_ch_client_thread_arg * thread_data ; /**< Data of the Call Home client's thread */
568562
569563 struct nc_ch_endpt {
570- char * name ;
564+ char * name ; /**< Identifier of the Call Home endpoint. */
571565#ifdef NC_ENABLED_SSH_TLS
572- char * referenced_endpt_name ;
566+ char * referenced_endpt_name ; /**< Reference to another endpoint (used for client authentication). */
573567#endif /* NC_ENABLED_SSH_TLS */
574- NC_TRANSPORT_IMPL ti ;
575568
576- char * src_addr ; /**< IP address to bind to when connecting to a Call Home client. */
577- uint16_t src_port ; /**< Port to bind to when connecting to a Call Home client. */
578- char * dst_addr ; /**< IP address of the Call Home client. */
579- uint16_t dst_port ; /**< Port of the Call Home client. */
569+ char * src_addr ; /**< IP address to bind to when connecting to a Call Home client. */
570+ uint16_t src_port ; /**< Port to bind to when connecting to a Call Home client. */
571+ char * dst_addr ; /**< IP address of the Call Home client. */
572+ uint16_t dst_port ; /**< Port of the Call Home client. */
580573
581- int sock_pending ;
582- struct nc_keepalives ka ;
574+ int sock_pending ; /**< Socket file descriptor of the pending connection to the Call Home client. */
575+ struct nc_keepalives ka ; /**< Keepalives configuration data for the Call Home endpoint. */
583576
577+ NC_TRANSPORT_IMPL ti ; /**< Transport implementation of the Call Home endpoint. */
584578 union {
585579#ifdef NC_ENABLED_SSH_TLS
586- struct nc_server_ssh_opts * ssh ;
587-
588- struct nc_server_tls_opts * tls ;
580+ struct nc_server_ssh_opts * ssh ; /**< SSH transport options for the Call Home endpoint. */
581+ struct nc_server_tls_opts * tls ; /**< TLS transport options for the Call Home endpoint. */
589582#endif /* NC_ENABLED_SSH_TLS */
590583 } opts ;
591- } * ch_endpts ;
592- uint16_t ch_endpt_count ;
584+ } * ch_endpts ; /**< Array of Call Home endpoints. */
585+ uint16_t ch_endpt_count ; /**< Number of Call Home endpoints. */
593586
594- NC_CH_CONN_TYPE conn_type ;
587+ NC_CH_CONN_TYPE conn_type ; /**< Type of the Call Home connection. */
595588 struct {
596- uint16_t period ;
597- time_t anchor_time ;
598- uint16_t idle_timeout ;
589+ uint16_t period ; /**< Period of a periodic Call Home connection in seconds. */
590+ time_t anchor_time ; /**< Anchor time of a periodic Call Home connection. */
591+ uint16_t idle_timeout ; /**< Idle timeout of a periodic Call Home connection in seconds. */
599592 };
600593
601- NC_CH_START_WITH start_with ;
602- uint8_t max_attempts ;
603- uint16_t max_wait ;
594+ NC_CH_START_WITH start_with ; /**< How to select the Call Home endpoint to connect to. */
595+ uint8_t max_attempts ; /**< Maximum number of attempts to connect to the given Call Home endpoint. */
596+ uint16_t max_wait ; /**< Maximum time to wait for a Call Home connection in seconds. */
604597 uint32_t id ;
605- } * ch_clients ;
606- uint16_t ch_client_count ;
598+ } * ch_clients ; /**< Array of Call Home clients. */
599+ uint16_t ch_client_count ; /**< Number of Call Home clients. */
607600
608601#ifdef NC_ENABLED_SSH_TLS
602+ /**
603+ * @brief Data for dispatching Call Home clients.
604+ */
609605 struct nc_ch_dispatch_data {
610- nc_server_ch_session_acquire_ctx_cb acquire_ctx_cb ;
611- nc_server_ch_session_release_ctx_cb release_ctx_cb ;
612- void * ctx_cb_data ;
613- nc_server_ch_new_session_cb new_session_cb ;
614- void * new_session_cb_data ;
606+ nc_server_ch_session_acquire_ctx_cb acquire_ctx_cb ; /**< Acquiring libyang context callback. */
607+ nc_server_ch_session_release_ctx_cb release_ctx_cb ; /**< Releasing libyang context callback. */
608+ void * ctx_cb_data ; /**< Data passed to the callbacks above. */
609+ nc_server_ch_new_session_cb new_session_cb ; /**< New session callback. */
610+ void * new_session_cb_data ; /**< Data passed to the new_session_cb callback. */
615611 } ch_dispatch_data ;
616- #endif /* NC_ENABLED_SSH_TLS */
617-
618- /* ACCESS unlocked */
619- ATOMIC_T new_session_id ;
620- ATOMIC_T new_client_id ;
621612
622- #ifdef NC_ENABLED_SSH_TLS
623- /* ACCESS locked */
624613 struct {
625- pthread_t tid ; /**< Thread ID of the certificate expiration notification thread. */
626- int thread_running ; /**< Flag representing the runningness of the cert exp notification thread. */
627- pthread_mutex_t lock ; /**< Certificate expiration notification thread's data and cond lock. */
628- pthread_cond_t cond ; /**< Condition for the certificate expiration notification thread. */
614+ pthread_t tid ; /**< Thread ID of the certificate expiration notification thread. */
615+ int thread_running ; /**< Flag representing the runningness of the cert exp notification thread. */
616+ pthread_mutex_t lock ; /**< Certificate expiration notification thread's data and cond lock. */
617+ pthread_cond_t cond ; /**< Condition for the certificate expiration notification thread. */
629618
630619 /**
631620 * @brief Intervals for certificate expiration notifications.
632621 */
633622 struct nc_interval {
634- struct nc_cert_exp_time anchor ; /**< Lower bound of the given interval. */
635- struct nc_cert_exp_time period ; /**< Period of the given interval. */
623+ struct nc_cert_exp_time anchor ; /**< Lower bound of the given interval. */
624+ struct nc_cert_exp_time period ; /**< Period of the given interval. */
636625 } * intervals ;
637- int interval_count ; /**< Number of intervals. */
626+ int interval_count ; /**< Number of intervals. */
638627 } cert_exp_notif ;
628+ #endif /* NC_ENABLED_SSH_TLS */
629+
630+ /* ACCESS locked - bind_lock */
631+ struct nc_bind * binds ; /**< Array of server's socket binds. The count is the same as endpt_count. */
632+ pthread_mutex_t bind_lock ; /**< To avoid concurrent calls of poll and accept on the bound sockets. **/
639633
640634 /* ACCESS unlocked */
635+ ATOMIC_T new_session_id ;
636+ ATOMIC_T new_client_id ;
637+
638+ #ifdef NC_ENABLED_SSH_TLS
639+ /* ACCESS unlocked - set from env */
641640 FILE * tls_keylog_file ; /**< File to log TLS secrets to. */
642641#endif
643642};
0 commit comments