libnetconf2 2.0.24
NETCONF server and client library in C.
Loading...
Searching...
No Matches
session.h File Reference

libnetconf2 session manipulation More...

#include "netconf.h"
Include dependency graph for session.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  NC_CH_CONN_TYPE { NC_CH_CT_NOT_SET = 0 , NC_CH_PERSIST , NC_CH_PERIOD }
 Enumeration of Call Home connection types. More...
 
enum  NC_CH_START_WITH { NC_CH_FIRST_LISTED = 0 , NC_CH_LAST_CONNECTED , NC_CH_RANDOM }
 Enumeration of Call Home client priority policy. More...
 
enum  NC_SSH_AUTH_TYPE { NC_SSH_AUTH_PUBLICKEY = 0x01 , NC_SSH_AUTH_PASSWORD = 0x02 , NC_SSH_AUTH_INTERACTIVE = 0x04 }
 Enumeration of NETCONF SSH authentication methods. More...
 
enum  NC_SSH_KEY_TYPE { NC_SSH_KEY_UNKNOWN = 0 , NC_SSH_KEY_DSA , NC_SSH_KEY_RSA , NC_SSH_KEY_ECDSA }
 Enumeration of SSH key types. More...
 
enum  NC_STATUS {
  NC_STATUS_ERR = -1 , NC_STATUS_STARTING = 0 , NC_STATUS_CLOSING , NC_STATUS_INVALID ,
  NC_STATUS_RUNNING
}
 Enumeration of possible session statuses. More...
 
enum  NC_TLS_CTN_MAPTYPE {
  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
}
 Enumeration of cert-to-name mapping types. More...
 
enum  NC_TRANSPORT_IMPL {
  NC_TI_NONE = 0 , NC_TI_FD , NC_TI_UNIX , NC_TI_LIBSSH ,
  NC_TI_OPENSSL
}
 Enumeration of transport implementations (ways how libnetconf implements NETCONF transport protocol) More...
 

Functions

void nc_session_free (struct nc_session *session, void(*data_free)(void *))
 Free the NETCONF session object.
 
struct ly_ctx * nc_session_get_ctx (const struct nc_session *session)
 Get session context.
 
void * nc_session_get_data (const struct nc_session *session)
 Get the data assigned to a session.
 
const char * nc_session_get_host (const struct nc_session *session)
 Get session host.
 
uint32_t nc_session_get_id (const struct nc_session *session)
 Get session ID.
 
uint32_t nc_session_get_killed_by (const struct nc_session *session)
 Get session killer session ID.
 
const char * nc_session_get_path (const struct nc_session *session)
 Get session path (unix socket only).
 
uint16_t nc_session_get_port (const struct nc_session *session)
 Get session port.
 
NC_STATUS nc_session_get_status (const struct nc_session *session)
 Get session status.
 
NC_SESSION_TERM_REASON nc_session_get_term_reason (const struct nc_session *session)
 Get session termination reason.
 
NC_TRANSPORT_IMPL nc_session_get_ti (const struct nc_session *session)
 Get session transport used.
 
const char * nc_session_get_username (const struct nc_session *session)
 Get session username.
 
int nc_session_get_version (const struct nc_session *session)
 Get session NETCONF version.
 
void nc_session_set_data (struct nc_session *session, void *data)
 Assign arbitrary data to a session.
 
void nc_thread_destroy (void)
 Free all the dynamically allocated thread-specific libssl/libcrypto resources.
 

Detailed Description

libnetconf2 session manipulation

Author
Radek Krejci rkrej.nosp@m.ci@c.nosp@m.esnet.nosp@m..cz

Copyright (c) 2015 CESNET, z.s.p.o.

This source code is licensed under BSD 3-Clause License (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at

https://opensource.org/licenses/BSD-3-Clause

Definition in file session.h.

Enumeration Type Documentation

◆ NC_CH_CONN_TYPE

Enumeration of Call Home connection types.

Enumerator
NC_CH_CT_NOT_SET 
NC_CH_PERSIST 
NC_CH_PERIOD 

Definition at line 84 of file session.h.

◆ NC_CH_START_WITH

Enumeration of Call Home client priority policy.

Enumerator
NC_CH_FIRST_LISTED 
NC_CH_LAST_CONNECTED 
NC_CH_RANDOM 

Definition at line 93 of file session.h.

◆ NC_SSH_AUTH_TYPE

Enumeration of NETCONF SSH authentication methods.

Enumerator
NC_SSH_AUTH_PUBLICKEY 

publickey SSH authentication

NC_SSH_AUTH_PASSWORD 

password SSH authentication

NC_SSH_AUTH_INTERACTIVE 

interactive SSH authentication

Definition at line 29 of file session.h.

◆ NC_SSH_KEY_TYPE

Enumeration of SSH key types.

Enumerator
NC_SSH_KEY_UNKNOWN 
NC_SSH_KEY_DSA 
NC_SSH_KEY_RSA 
NC_SSH_KEY_ECDSA 

Definition at line 102 of file session.h.

◆ NC_STATUS

enum NC_STATUS

Enumeration of possible session statuses.

Enumerator
NC_STATUS_ERR 

error return code for function getting the session status

NC_STATUS_STARTING 

session is not yet fully initiated

NC_STATUS_CLOSING 

session is being closed

NC_STATUS_INVALID 

session is not running and is supposed to be closed (nc_session_free())

NC_STATUS_RUNNING 

up and running

Definition at line 57 of file session.h.

◆ NC_TLS_CTN_MAPTYPE

Enumeration of cert-to-name mapping types.

Enumerator
NC_TLS_CTN_UNKNOWN 

unknown mapping

NC_TLS_CTN_SPECIFIED 

username explicitly specified

NC_TLS_CTN_SAN_RFC822_NAME 

email address as username

NC_TLS_CTN_SAN_DNS_NAME 

DNS name as username

NC_TLS_CTN_SAN_IP_ADDRESS 

IP address as username

NC_TLS_CTN_SAN_ANY 

any certificate Subject Alternative Name as username

NC_TLS_CTN_COMMON_NAME 

common name as username

Definition at line 42 of file session.h.

◆ NC_TRANSPORT_IMPL

Enumeration of transport implementations (ways how libnetconf implements NETCONF transport protocol)

Enumerator
NC_TI_NONE 

none - session is not connected yet

NC_TI_FD 

file descriptors - use standard input/output, transport protocol is implemented outside the current application

NC_TI_UNIX 

unix socket

NC_TI_LIBSSH 

libssh - use libssh library, only for NETCONF over SSH transport

NC_TI_OPENSSL 

OpenSSL - use OpenSSL library, only for NETCONF over TLS transport

Definition at line 68 of file session.h.

Function Documentation

◆ nc_session_free()

void nc_session_free ( struct nc_session *  session,
void(*)(void *)  data_free 
)

Free the NETCONF session object.

Parameters
[in]sessionObject to free.
[in]data_freeSession user data destructor.

◆ nc_session_get_ctx()

struct ly_ctx * nc_session_get_ctx ( const struct nc_session *  session)

Get session context.

Parameters
[in]sessionSession to get the information from.
Returns
Session context.

◆ nc_session_get_data()

void * nc_session_get_data ( const struct nc_session *  session)

Get the data assigned to a session.

Parameters
[in]sessionSession to get the data from.
Returns
Session-specific data.

◆ nc_session_get_host()

const char * nc_session_get_host ( const struct nc_session *  session)

Get session host.

Parameters
[in]sessionSession to get the information from.
Returns
Session host.

◆ nc_session_get_id()

uint32_t nc_session_get_id ( const struct nc_session *  session)

Get session ID.

Parameters
[in]sessionSession to get the information from.
Returns
Session ID.

◆ nc_session_get_killed_by()

uint32_t nc_session_get_killed_by ( const struct nc_session *  session)

Get session killer session ID.

Parameters
[in]sessionSession to get the information from.
Returns
Session killer ID.

◆ nc_session_get_path()

const char * nc_session_get_path ( const struct nc_session *  session)

Get session path (unix socket only).

Parameters
[in]sessionSession to get the information from.
Returns
Session unix socket path.

◆ nc_session_get_port()

uint16_t nc_session_get_port ( const struct nc_session *  session)

Get session port.

Parameters
[in]sessionSession to get the information from.
Returns
Session port.

◆ nc_session_get_status()

NC_STATUS nc_session_get_status ( const struct nc_session *  session)

Get session status.

Parameters
[in]sessionSession to get the information from.
Returns
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.

Parameters
[in]sessionSession to get the information from.
Returns
Session termination reason enum value.

◆ nc_session_get_ti()

NC_TRANSPORT_IMPL nc_session_get_ti ( const struct nc_session *  session)

Get session transport used.

Parameters
[in]sessionSession to get the information from.
Returns
Session transport.

◆ nc_session_get_username()

const char * nc_session_get_username ( const struct nc_session *  session)

Get session username.

Parameters
[in]sessionSession to get the information from.
Returns
Session username.

◆ nc_session_get_version()

int nc_session_get_version ( const struct nc_session *  session)

Get session NETCONF version.

Parameters
[in]sessionSession to get the information from.
Returns
0 for version 1.0, non-zero for version 1.1.

◆ nc_session_set_data()

void nc_session_set_data ( struct nc_session *  session,
void *  data 
)

Assign arbitrary data to a session.

Parameters
[in]sessionSession to modify.
[in]dataData to be stored in the session.

◆ nc_thread_destroy()

void nc_thread_destroy ( void  )

Free all the dynamically allocated thread-specific libssl/libcrypto resources.

This function should be called only if init (nc_client_init(), respectively nc_server_init()) was called. Call it in every thread your application creates just before the thread exits. In the last thread (usually the main one) call nc_client_destroy(), respectively nc_server_destroy().