From eb3d6cd54f640a9fd8e477a8a86e5f68b8ea35ea Mon Sep 17 00:00:00 2001 From: roman Date: Fri, 18 Oct 2024 09:49:48 +0200 Subject: [PATCH] session_p REFACTOR group up session flags --- src/session_p.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/session_p.h b/src/session_p.h index 0e73be8c..ab88cfd3 100644 --- a/src/session_p.h +++ b/src/session_p.h @@ -757,10 +757,23 @@ struct nc_session { struct ly_ctx *ctx; /**< libyang context of the session */ void *data; /**< arbitrary user data */ uint8_t flags; /**< various flags of the session */ -#define NC_SESSION_SHAREDCTX 0x01 + +/* shared flags */ +#define NC_SESSION_SHAREDCTX 0x01 /**< context is shared */ #define NC_SESSION_CALLHOME 0x02 /**< session is Call Home and ch_lock is initialized */ #define NC_SESSION_CH_THREAD 0x04 /**< protected by ch_lock */ +/* client flags */ +#define NC_SESSION_CLIENT_NOT_STRICT 0x08 /**< some server modules failed to load so the data from + them will be ignored - not use strict flag for parsing */ +#define NC_SESSION_CLIENT_MONITORED 0x40 /**< session is being monitored by the client monitoring thread */ + +/* server flags */ +#ifdef NC_ENABLED_SSH_TLS +#define NC_SESSION_SSH_AUTHENTICATED 0x10 /**< SSH session authenticated */ +#define NC_SESSION_SSH_SUBSYS_NETCONF 0x20 /**< netconf subsystem requested */ +#endif + union { struct { /* client side only data */ @@ -771,11 +784,6 @@ struct nc_session { ATOMIC_T ntf_thread_count; /**< number of running notification threads */ ATOMIC_T ntf_thread_running; /**< flag whether there are notification threads for this session running or not */ struct lyd_node *ext_data; /**< LY ext data used in the context callback */ - - /* client flags */ - /* some server modules failed to load so the data from them will be ignored - not use strict flag for parsing */ -# define NC_SESSION_CLIENT_NOT_STRICT 0x08 -# define NC_SESSION_CLIENT_MONITORED 0x40 /**< session is being monitored by the client monitoring thread */ } client; struct { /* server side only data */ @@ -793,14 +801,8 @@ struct nc_session { pthread_mutex_t ch_lock; /**< Call Home thread lock */ pthread_cond_t ch_cond; /**< Call Home thread condition */ - /* server flags */ #ifdef NC_ENABLED_SSH_TLS - /* SSH session authenticated */ -# define NC_SESSION_SSH_AUTHENTICATED 0x10 - /* netconf subsystem requested */ -# define NC_SESSION_SSH_SUBSYS_NETCONF 0x20 uint16_t ssh_auth_attempts; /**< number of failed SSH authentication attempts */ - void *client_cert; /**< TLS client certificate if used for authentication */ #endif /* NC_ENABLED_SSH_TLS */ } server;