session.h
Go to the documentation of this file.
#ifndef NC_SESSION_H_
#define NC_SESSION_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "netconf.h"
#ifdef NC_ENABLED_SSH
typedef enum {
NC_SSH_AUTH_PUBLICKEY = 0x01,
NC_SSH_AUTH_PASSWORD = 0x02,
NC_SSH_AUTH_INTERACTIVE = 0x04
} NC_SSH_AUTH_TYPE;
#endif /* NC_ENABLED_SSH */
#ifdef NC_ENABLED_TLS
typedef enum {
NC_TLS_CTN_UNKNOWN = 0,
NC_TLS_CTN_SPECIFIED,
NC_TLS_CTN_SAN_RFC822_NAME,
NC_TLS_CTN_SAN_DNS_NAME,
NC_TLS_CTN_SAN_IP_ADDRESS,
NC_TLS_CTN_SAN_ANY,
NC_TLS_CTN_COMMON_NAME
} NC_TLS_CTN_MAPTYPE;
#endif /* NC_ENABLED_TLS */
typedef enum {
NC_STATUS_ERR = -1,
NC_STATUS_STARTING = 0,
NC_STATUS_CLOSING,
NC_STATUS_INVALID,
NC_STATUS_RUNNING
} NC_STATUS;
typedef enum {
NC_TI_NONE = 0,
NC_TI_FD,
NC_TI_UNIX,
#ifdef NC_ENABLED_SSH
NC_TI_LIBSSH,
#endif
#ifdef NC_ENABLED_TLS
NC_TI_OPENSSL
#endif
} NC_TRANSPORT_IMPL;
typedef enum {
NC_CH_CT_NOT_SET = 0,
NC_CH_PERSIST,
NC_CH_PERIOD
} NC_CH_CONN_TYPE;
typedef enum {
NC_CH_FIRST_LISTED = 0, // default
NC_CH_LAST_CONNECTED,
NC_CH_RANDOM
} NC_CH_START_WITH;
typedef enum {
NC_SSH_KEY_UNKNOWN = 0,
NC_SSH_KEY_DSA,
NC_SSH_KEY_RSA,
NC_SSH_KEY_ECDSA
} NC_SSH_KEY_TYPE;
struct nc_session;
NC_STATUS nc_session_get_status(const struct nc_session *session);
NC_SESSION_TERM_REASON nc_session_get_term_reason(const struct nc_session *session);
uint32_t nc_session_get_killed_by(const struct nc_session *session);
uint32_t nc_session_get_id(const struct nc_session *session);
int nc_session_get_version(const struct nc_session *session);
NC_TRANSPORT_IMPL nc_session_get_ti(const struct nc_session *session);
const char *nc_session_get_username(const struct nc_session *session);
const char *nc_session_get_host(const struct nc_session *session);
uint16_t nc_session_get_port(const struct nc_session *session);
const char *nc_session_get_path(const struct nc_session *session);
struct ly_ctx *nc_session_get_ctx(const struct nc_session *session);
void nc_session_set_data(struct nc_session *session, void *data);
void *nc_session_get_data(const struct nc_session *session);
void nc_session_free(struct nc_session *session, void (*data_free)(void *));
#if defined (NC_ENABLED_SSH) || defined (NC_ENABLED_TLS)
void nc_thread_destroy(void);
#endif /* NC_ENABLED_SSH || NC_ENABLED_TLS */
#ifdef __cplusplus
}
#endif
#endif /* NC_SESSION_H_ */
NC_SESSION_TERM_REASON
NC_SESSION_TERM_REASON
Enumeration of reasons of the NETCONF session termination as defined in RFC 6470.
Definition: netconf.h:55
netconf.h
libnetconf2's general public functions and structures definitions.
NC_TLS_CTN_MAPTYPE
NC_TLS_CTN_MAPTYPE
Enumeration of cert-to-name mapping types.
Definition: session.h:42
NC_TLS_CTN_SAN_ANY
@ NC_TLS_CTN_SAN_ANY
Definition: session.h:48
NC_TLS_CTN_SAN_IP_ADDRESS
@ NC_TLS_CTN_SAN_IP_ADDRESS
Definition: session.h:47
NC_TLS_CTN_SAN_RFC822_NAME
@ NC_TLS_CTN_SAN_RFC822_NAME
Definition: session.h:45
NC_TLS_CTN_SPECIFIED
@ NC_TLS_CTN_SPECIFIED
Definition: session.h:44
NC_TLS_CTN_SAN_DNS_NAME
@ NC_TLS_CTN_SAN_DNS_NAME
Definition: session.h:46
NC_TLS_CTN_UNKNOWN
@ NC_TLS_CTN_UNKNOWN
Definition: session.h:43
NC_TLS_CTN_COMMON_NAME
@ NC_TLS_CTN_COMMON_NAME
Definition: session.h:49
NC_STATUS
NC_STATUS
Enumeration of possible session statuses.
Definition: session.h:57
NC_STATUS_INVALID
@ NC_STATUS_INVALID
Definition: session.h:61
NC_STATUS_RUNNING
@ NC_STATUS_RUNNING
Definition: session.h:62
NC_STATUS_ERR
@ NC_STATUS_ERR
Definition: session.h:58
NC_STATUS_STARTING
@ NC_STATUS_STARTING
Definition: session.h:59
NC_STATUS_CLOSING
@ NC_STATUS_CLOSING
Definition: session.h:60
nc_session_free
void nc_session_free(struct nc_session *session, void(*data_free)(void *))
Free the NETCONF session object.
NC_CH_START_WITH
NC_CH_START_WITH
Enumeration of Call Home client priority policy.
Definition: session.h:93
NC_CH_LAST_CONNECTED
@ NC_CH_LAST_CONNECTED
Definition: session.h:95
NC_CH_FIRST_LISTED
@ NC_CH_FIRST_LISTED
Definition: session.h:94
NC_CH_RANDOM
@ NC_CH_RANDOM
Definition: session.h:96
nc_session_get_status
NC_STATUS nc_session_get_status(const struct nc_session *session)
Get session status.
nc_session_get_term_reason
NC_SESSION_TERM_REASON nc_session_get_term_reason(const struct nc_session *session)
Get session termination reason.
nc_session_get_path
const char * nc_session_get_path(const struct nc_session *session)
Get session path (unix socket only).
NC_CH_CONN_TYPE
NC_CH_CONN_TYPE
Enumeration of Call Home connection types.
Definition: session.h:84
NC_CH_PERSIST
@ NC_CH_PERSIST
Definition: session.h:86
NC_CH_PERIOD
@ NC_CH_PERIOD
Definition: session.h:87
NC_CH_CT_NOT_SET
@ NC_CH_CT_NOT_SET
Definition: session.h:85
nc_session_get_host
const char * nc_session_get_host(const struct nc_session *session)
Get session host.
nc_thread_destroy
void nc_thread_destroy(void)
Free all the dynamically allocated thread-specific libssl/libcrypto resources.
nc_session_get_ctx
struct ly_ctx * nc_session_get_ctx(const struct nc_session *session)
Get session context.
NC_SSH_KEY_TYPE
NC_SSH_KEY_TYPE
Enumeration of SSH key types.
Definition: session.h:102
NC_SSH_KEY_DSA
@ NC_SSH_KEY_DSA
Definition: session.h:104
NC_SSH_KEY_ECDSA
@ NC_SSH_KEY_ECDSA
Definition: session.h:106
NC_SSH_KEY_RSA
@ NC_SSH_KEY_RSA
Definition: session.h:105
NC_SSH_KEY_UNKNOWN
@ NC_SSH_KEY_UNKNOWN
Definition: session.h:103
NC_TRANSPORT_IMPL
NC_TRANSPORT_IMPL
Enumeration of transport implementations (ways how libnetconf implements NETCONF transport protocol)
Definition: session.h:68
NC_TI_OPENSSL
@ NC_TI_OPENSSL
Definition: session.h:77
NC_TI_UNIX
@ NC_TI_UNIX
Definition: session.h:72
NC_TI_FD
@ NC_TI_FD
Definition: session.h:70
NC_TI_NONE
@ NC_TI_NONE
Definition: session.h:69
NC_TI_LIBSSH
@ NC_TI_LIBSSH
Definition: session.h:74
nc_session_get_data
void * nc_session_get_data(const struct nc_session *session)
Get the data assigned to a session.
nc_session_get_version
int nc_session_get_version(const struct nc_session *session)
Get session NETCONF version.
NC_SSH_AUTH_TYPE
NC_SSH_AUTH_TYPE
Enumeration of NETCONF SSH authentication methods.
Definition: session.h:29
NC_SSH_AUTH_INTERACTIVE
@ NC_SSH_AUTH_INTERACTIVE
Definition: session.h:32
NC_SSH_AUTH_PASSWORD
@ NC_SSH_AUTH_PASSWORD
Definition: session.h:31
NC_SSH_AUTH_PUBLICKEY
@ NC_SSH_AUTH_PUBLICKEY
Definition: session.h:30
nc_session_get_username
const char * nc_session_get_username(const struct nc_session *session)
Get session username.
nc_session_set_data
void nc_session_set_data(struct nc_session *session, void *data)
Assign arbitrary data to a session.
nc_session_get_port
uint16_t nc_session_get_port(const struct nc_session *session)
Get session port.
nc_session_get_ti
NC_TRANSPORT_IMPL nc_session_get_ti(const struct nc_session *session)
Get session transport used.
nc_session_get_id
uint32_t nc_session_get_id(const struct nc_session *session)
Get session ID.
nc_session_get_killed_by
uint32_t nc_session_get_killed_by(const struct nc_session *session)
Get session killer session ID.