Loading...
Searching...
No Matches
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_TLS
typedef enum {
NC_SSH_AUTH_PUBLICKEY = 0x01,
NC_SSH_AUTH_PASSWORD = 0x02,
NC_SSH_AUTH_INTERACTIVE = 0x04
} NC_SSH_AUTH_TYPE;
typedef enum {
NC_SSH_KNOWNHOSTS_ASK = 0,
NC_SSH_KNOWNHOSTS_STRICT,
NC_SSH_KNOWNHOSTS_ACCEPT_NEW,
NC_SSH_KNOWNHOSTS_ACCEPT,
NC_SSH_KNOWNHOSTS_SKIP
} NC_SSH_KNOWNHOSTS_MODE;
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;
typedef enum {
NC_TLS_VERSION_10 = 1,
NC_TLS_VERSION_11 = 2,
NC_TLS_VERSION_12 = 4,
NC_TLS_VERSION_13 = 8
} NC_TLS_VERSION;
#endif /* NC_ENABLED_SSH_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_TLS
NC_TI_SSH,
NC_TI_TLS
#endif /* NC_ENABLED_SSH_TLS */
} 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;
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);
#ifdef NC_ENABLED_SSH_TLS
const char *nc_session_ssh_get_banner(const struct nc_session *session);
#endif
const char *nc_session_get_path(const struct nc_session *session);
const 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);
int nc_session_is_callhome(const struct nc_session *session);
void nc_session_free(struct nc_session *session, void (*data_free)(void *));
#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:54
netconf.h
libnetconf2's general public functions and structures definitions.
nc_session_is_callhome
int nc_session_is_callhome(const struct nc_session *session)
Learn whether a session was created using Call Home or not.
NC_TLS_CTN_MAPTYPE
NC_TLS_CTN_MAPTYPE
Enumeration of cert-to-name mapping types.
Definition session.h:51
NC_TLS_CTN_SAN_ANY
@ NC_TLS_CTN_SAN_ANY
Definition session.h:57
NC_TLS_CTN_SAN_IP_ADDRESS
@ NC_TLS_CTN_SAN_IP_ADDRESS
Definition session.h:56
NC_TLS_CTN_SAN_RFC822_NAME
@ NC_TLS_CTN_SAN_RFC822_NAME
Definition session.h:54
NC_TLS_CTN_SPECIFIED
@ NC_TLS_CTN_SPECIFIED
Definition session.h:53
NC_TLS_CTN_SAN_DNS_NAME
@ NC_TLS_CTN_SAN_DNS_NAME
Definition session.h:55
NC_TLS_CTN_UNKNOWN
@ NC_TLS_CTN_UNKNOWN
Definition session.h:52
NC_TLS_CTN_COMMON_NAME
@ NC_TLS_CTN_COMMON_NAME
Definition session.h:58
NC_STATUS
NC_STATUS
Enumeration of possible session statuses.
Definition session.h:76
NC_STATUS_INVALID
@ NC_STATUS_INVALID
Definition session.h:80
NC_STATUS_RUNNING
@ NC_STATUS_RUNNING
Definition session.h:81
NC_STATUS_ERR
@ NC_STATUS_ERR
Definition session.h:77
NC_STATUS_STARTING
@ NC_STATUS_STARTING
Definition session.h:78
NC_STATUS_CLOSING
@ NC_STATUS_CLOSING
Definition session.h:79
NC_SSH_KNOWNHOSTS_MODE
NC_SSH_KNOWNHOSTS_MODE
Enumeration of host key checking and known_hosts entry adding modes.
Definition session.h:40
NC_SSH_KNOWNHOSTS_STRICT
@ NC_SSH_KNOWNHOSTS_STRICT
Definition session.h:42
NC_SSH_KNOWNHOSTS_ASK
@ NC_SSH_KNOWNHOSTS_ASK
Definition session.h:41
NC_SSH_KNOWNHOSTS_ACCEPT_NEW
@ NC_SSH_KNOWNHOSTS_ACCEPT_NEW
Definition session.h:43
NC_SSH_KNOWNHOSTS_ACCEPT
@ NC_SSH_KNOWNHOSTS_ACCEPT
Definition session.h:44
NC_SSH_KNOWNHOSTS_SKIP
@ NC_SSH_KNOWNHOSTS_SKIP
Definition session.h:45
nc_session_get_data
void * nc_session_get_data(const struct nc_session *session)
Get the data assigned to a session.
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:111
NC_CH_LAST_CONNECTED
@ NC_CH_LAST_CONNECTED
Definition session.h:113
NC_CH_FIRST_LISTED
@ NC_CH_FIRST_LISTED
Definition session.h:112
NC_CH_RANDOM
@ NC_CH_RANDOM
Definition session.h:114
nc_session_get_status
NC_STATUS nc_session_get_status(const struct nc_session *session)
Get session status.
nc_session_get_path
const char * nc_session_get_path(const struct nc_session *session)
Get session path (unix socket only).
nc_session_get_term_reason
NC_SESSION_TERM_REASON nc_session_get_term_reason(const struct nc_session *session)
Get session termination reason.
NC_CH_CONN_TYPE
NC_CH_CONN_TYPE
Enumeration of Call Home connection types.
Definition session.h:102
NC_CH_PERSIST
@ NC_CH_PERSIST
Definition session.h:104
NC_CH_PERIOD
@ NC_CH_PERIOD
Definition session.h:105
NC_CH_CT_NOT_SET
@ NC_CH_CT_NOT_SET
Definition session.h:103
nc_session_get_ctx
const struct ly_ctx * nc_session_get_ctx(const struct nc_session *session)
Get session context.
nc_session_get_username
const char * nc_session_get_username(const struct nc_session *session)
Get session username.
NC_TLS_VERSION
NC_TLS_VERSION
Enumeration of TLS versions.
Definition session.h:64
NC_TLS_VERSION_10
@ NC_TLS_VERSION_10
Definition session.h:65
NC_TLS_VERSION_11
@ NC_TLS_VERSION_11
Definition session.h:66
NC_TLS_VERSION_13
@ NC_TLS_VERSION_13
Definition session.h:68
NC_TLS_VERSION_12
@ NC_TLS_VERSION_12
Definition session.h:67
NC_TRANSPORT_IMPL
NC_TRANSPORT_IMPL
Enumeration of transport implementations (ways how libnetconf implements NETCONF transport protocol)
Definition session.h:87
NC_TI_UNIX
@ NC_TI_UNIX
Definition session.h:91
NC_TI_FD
@ NC_TI_FD
Definition session.h:89
NC_TI_TLS
@ NC_TI_TLS
Definition session.h:95
NC_TI_NONE
@ NC_TI_NONE
Definition session.h:88
NC_TI_SSH
@ NC_TI_SSH
Definition session.h:93
nc_session_get_host
const char * nc_session_get_host(const struct nc_session *session)
Get session host.
nc_session_ssh_get_banner
const char * nc_session_ssh_get_banner(const struct nc_session *session)
Get the SSH banner sent by the peer.
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:31
NC_SSH_AUTH_INTERACTIVE
@ NC_SSH_AUTH_INTERACTIVE
Definition session.h:34
NC_SSH_AUTH_PASSWORD
@ NC_SSH_AUTH_PASSWORD
Definition session.h:33
NC_SSH_AUTH_PUBLICKEY
@ NC_SSH_AUTH_PUBLICKEY
Definition session.h:32
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.