yumapro  24.10-2
YumaPro SDK
Loading...
Searching...
No Matches
Session Data Structures

Macros and data structures used for session management. More...

Collaboration diagram for Session Data Structures:

Data Structures

struct  ses_stats_t
 Per Session Statistics. More...
 
struct  ses_total_stats_t
 Session Total Statistics. More...
 
struct  ses_msg_buff_t
 Session Message Buffer. More...
 
struct  ses_ready_t
 embedded Q header for the message ready Q The 'inq' flag is used to prevent queue corruption More...
 
struct  ses_msg_t
 Session Message. More...
 
struct  ses_cb_t
 Session Control Block. More...
 

Macros

#define SES_MY_SID(S)   ((S)->sid)
 get session-id
 
#define SES_MY_FD(S)   ((S)->fd)
 get file descriptor
 
#define SES_MY_USERNAME(S)   ((S)->username)
 get username
 
#define SES_KILLREQ_SET(S)   ((S)->state >= SES_ST_SHUTDOWN_REQ)
 check if a kill request is set
 
#define SES_ACK_KILLREQ(S)   ((S)->state = SES_ST_SHUTDOWN)
 ack a kill request
 
#define SES_OUT_BYTES(S)   (S)->stats.out_bytes
 get session out bytes
 
#define SES_LINELEN(S)   (S)->stats.out_line
 get current out line number
 
#define SES_LINESIZE(S)   (S)->linesize
 get current line size
 
#define SES_IN_ENCODING(S)   (S)->in_encoding
 get the inbound message encoding
 
#define SES_OUT_ENCODING(S)   (S)->out_encoding
 get the outbound message encoding
 
#define SES_IS_DUMMY(S)   ((S)->sid == 0)
 test if this is a dummy session
 
#define SES_IS_YCONTROL(S)   ((S)->ycontrol)
 test if this is a YControl session
 
#define SES_CONN_CLOSED(S)   (S)->conn_closed
 check if the connection is closed
 
#define SES_SET_CUR_RPC_MSG(S, MSG)   (S)->cur_rpc_msg = MSG
 set the current RPC message
 
#define SES_GET_CUR_RPC_MSG(S)   (S)->cur_rpc_msg
 get the current RPC message
 
#define SES_GET_JSON_1LINE(S)   (S)->json_1line
 get the JSON 1 line state
 
#define SES_USE_JSON_ATTRS(S)   (S)->json_attrs
 get the JSON use attributes flag
 
#define SES_SET_JSON_ATTRS(S)   (S)->json_attrs = TRUE
 set the JSON attributes flag
 
#define SES_SET_LEAFLIST_PTR(S, V)   (S)->leaflist = V
 set the session leaf-list pointer
 
#define SES_GET_LEAFLIST_PTR(S)   (S)->leaflist
 get the session leaf-list pointer
 
#define SES_SET_LEAFLIST_ATTRS(S, A)   (S)->any_leaflist_attrs = A
 set the leaf-list attributes
 
#define SES_GET_LEAFLIST_ATTRS(S)   (S)->any_leaflist_attrs
 get the leaf-list attributes
 
#define SES_KEEP_XMLNS(S)   (S)->keep_xmlns
 get keep xmlns attributes flag
 
#define SES_RAWXML_MODE(S)   (S)->rawxml_mode
 get the raw XML mode
 
#define SES_STATE(S)   (S)->state
 get the session state
 
#define SES_PEERADDR(S)   (S)->peeraddr
 get the session peer address
 
#define SES_PEERPORT(S)   (S)->peerport
 get the session peer port number
 
#define SES_TRANSPORT(S)   (S)->transport
 get the session transport enum
 
#define SES_PROTOCOL(S)   (S)->protocol
 get the session protocol enum
 
#define SES_IS_IPV6(S)   (S)->is_ipv6
 check if the session is using IPv6
 
#define SES_IS_CALLHOME(S)   (S)->is_callhome
 check if this is a callhome session
 
#define SES_TYPE(S)   (S)->type
 get the session type
 
#define SES_GET_COOKIE(S)   (S)->get_cookie
 get the session cookie
 
#define SES_BREADCRUMBQ(S)   &(S)->breadcrumbQ
 get the session breadcrumb Q
 
#define SES_CURMSG(S)   (S)->curmsg
 get the session current message
 
#define SES_START_TLS(S)   (S)->start_tls
 get the start TLS flag
 
#define SES_WILDCARD_OK(S)   (S)->wildcard_ok
 check if wildcard OK in XML filters
 
#define SES_MGRCB(S)   (S)->mgrcb
 get the manager session control block
 
#define SES_NOTIF_ACTIVE(S)   (S)->notif_active
 check if notifications are active
 
#define SES_RFC8639_NOTIF_COUNT(S)   (S)->rfc8639_notif_cnt
 get the notification count
 
#define SES_BINARY_NOTIFS(S)   (S)->binary_notifs
 establish-subscription used with encode-yang-cbor used on the session S
 
#define BINLOG   (const xmlChar *)"***binary***"
 If binary encoding then this message will be printed instead of showing binary characters in the log files.
 
#define SES_CALLHOME_NAME(S)   (S)->callhome_name
 agt only: Get the name of the callhome server that this session was started for so it can be reconnected only applies to NETCONF over TLS sessions
 
#define SES_FREE_PENDING(S)   (S)->free_pending
 agt only: Set this flag in agt_ses to delay freeing a subsystem session that is in progress with a remote transaction This will cause agt_top to clean up the session
 
#define SES_NULL_SID   0
 session ID zero not used
 
#define SES_MSG_BUFFSIZE   1000
 controls the size of each buffer chunk More...
 
#define SES_MAX_BUFFERS   500000
 max number of buffer chunks a session can have allocated at once This is an arbitrary limit – no static memory is allocated based on this constant
 
#define SES_MAX_FREE_BUFFERS   4
 max number of buffers a session is allowed to cache in its freeQ
 
#define SES_MAX_BUFFSEND   32
 max number of buffers to try to send in one call to the write fn
 
#define SES_MAX_BYTESEND   0xffff
 max number of bytes to try to send in one call to the write_fn
 
#define SES_DEF_LINESIZE   72
 max desired lines size; not a hard limit
 
#define SES_MAX_STARTCHUNK_SIZE   13
 max size of a valid base:1.1 chunk header start tag
 
#define SES_MAX_CHUNKNUM_SIZE   10
 max size of the chunk size number in the chunk start tag
 
#define SES_STARTCHUNK_PAD   10
 padding at start of buffer for chunk tagging More...
 
#define SES_ENDCHUNK_PAD   8
 leave enough room at the end for EOChunks for framing11 or http_chunk_mode
 
#define SES_READBUFF_SIZE   1000
 default read buffer size
 
#define SES_GET_YPMODE(S)   (S)->yp_mode
 get internal YP mode flag
 
#define SES_SET_YPMODE(S, V)   (S)->yp_mode = V
 set internal YP mode flag
 
#define SES_REMOTE_WAIT(S)   (S)->remote_wait
 get remote wait flag
 
#define SES_NEED_FILE_OVERRIDE(S)   ((S)->file_override && (S)->fp)
 get file override flag (used in client)
 
#define SES_SYSTEM_USERNAME   NCX_EL_SYSTEM
 system username used in agt_state to report session state
 

Typedefs

typedef uint32 ses_id_t
 Session ID.
 
typedef ssize_t(* ses_read_fn_t) (void *s, char *buff, size_t bufflen, bool *erragain)
 optional read function for the session More...
 
typedef status_t(* ses_write_fn_t) (void *s)
 optional write function for the session More...
 

Enumerations

enum  ses_ypmode_t {
  SES_YPMODE_NONE ,
  SES_YPMODE_HA ,
  SES_YPMODE_RESTCONF ,
  SES_YPMODE_NETCONF
}
 YANG-PATCH Mode. More...
 
enum  ses_type_t {
  SES_TYP_NONE ,
  SES_TYP_NETCONF ,
  SES_TYP_DUMMY ,
  SES_TYP_YCONTROL ,
  SES_TYP_COAP ,
  SES_TYP_SNMP ,
  SES_TYP_GNMI
}
 Session Types. More...
 
enum  ses_transport_t {
  SES_TRANSPORT_NONE ,
  SES_TRANSPORT_SSH ,
  SES_TRANSPORT_BEEP ,
  SES_TRANSPORT_SOAP ,
  SES_TRANSPORT_SOAPBEEP ,
  SES_TRANSPORT_TLS ,
  SES_TRANSPORT_TCP_TAILF ,
  SES_TRANSPORT_TCP_NCX ,
  SES_TRANSPORT_HTTP ,
  SES_TRANSPORT_CLI ,
  SES_TRANSPORT_WEBUI ,
  SES_TRANSPORT_AFLOCAL ,
  SES_TRANSPORT_COAP ,
  SES_TRANSPORT_COAP_DTLS ,
  SES_TRANSPORT_SNMP ,
  SES_TRANSPORT_NETCONF_TLS ,
  SES_TRANSPORT_GNMI
}
 NETCONF Transport Types. More...
 
enum  ses_state_t {
  SES_ST_NONE ,
  SES_ST_INIT ,
  SES_ST_HELLO_WAIT ,
  SES_ST_XRD_WAIT ,
  SES_ST_RESTCAPS_WAIT ,
  SES_ST_IDLE ,
  SES_ST_IN_MSG ,
  SES_ST_SHUTDOWN_REQ ,
  SES_ST_SHUTDOWN
}
 Session States. More...
 
enum  ses_instate_t {
  SES_INST_NONE ,
  SES_INST_IDLE ,
  SES_INST_INMSG ,
  SES_INST_INSTART ,
  SES_INST_INBETWEEN ,
  SES_INST_INEND
}
 Session Input Handler States for base:1.0 EOM processing. More...
 
enum  ses_mode_t {
  SES_MODE_NONE ,
  SES_MODE_XML ,
  SES_MODE_XMLDOC ,
  SES_MODE_HTML ,
  SES_MODE_TEXT ,
  SES_MODE_BINARY
}
 Session Output Mode. More...
 
enum  ses_term_reason_t {
  SES_TR_NONE ,
  SES_TR_CLOSED ,
  SES_TR_KILLED ,
  SES_TR_DROPPED ,
  SES_TR_TIMEOUT ,
  SES_TR_OTHER ,
  SES_TR_BAD_START ,
  SES_TR_BAD_HELLO
}
 Session Termination reason. More...
 
enum  ses_prolog_state_t {
  SES_PRST_NONE ,
  SES_PRST_WAITING ,
  SES_PRST_DONE
}
 prolog parsing state More...
 

Detailed Description

Macros and data structures used for session management.

The ses_cb_t is the session control block used throughout all programs that use sessions.

Macro Definition Documentation

◆ SES_MSG_BUFFSIZE

#define SES_MSG_BUFFSIZE   1000

controls the size of each buffer chunk

  !!! This was set to 2000 but this causes IP fragmentation
  !!! so it has been changed to 1000.
  In some small networks this could also cause IP fragmentation

◆ SES_STARTCHUNK_PAD

#define SES_STARTCHUNK_PAD   10

padding at start of buffer for chunk tagging

*
* Max: \n#xxxxxxx\n --> 7 digit chunk size
*
* HTTP chunk format
*   xxxxxxx\r\n
*
* 

Typedef Documentation

◆ ses_read_fn_t

typedef ssize_t(* ses_read_fn_t) (void *s, char *buff, size_t bufflen, bool *erragain)

optional read function for the session

Parameters
ssession control block cast as void *
buffbuffer to fill
bufflensize of buff
[out]erragainaddress of return EAGAIN flag
  • *erragain return EAGAIN flag
Returns
number bytes read

◆ ses_write_fn_t

typedef status_t(* ses_write_fn_t) (void *s)

optional write function for the session

Parameters
ssession control block cast as void *
Returns
status

Enumeration Type Documentation

◆ ses_instate_t

Session Input Handler States for base:1.0 EOM processing.

Enumerator
SES_INST_NONE 

not set

SES_INST_IDLE 

idle state

SES_INST_INMSG 

in message body

SES_INST_INSTART 

starting in the EOM field

SES_INST_INBETWEEN 

in between 2 messages

SES_INST_INEND 

ending the EOM field

◆ ses_mode_t

enum ses_mode_t

Session Output Mode.

Enumerator
SES_MODE_NONE 

not set

SES_MODE_XML 

XML mode.

SES_MODE_XMLDOC 

XML documentation mode.

SES_MODE_HTML 

HTML mode.

SES_MODE_TEXT 

text mode

SES_MODE_BINARY 

binary mode

◆ ses_prolog_state_t

prolog parsing state

Enumerator
SES_PRST_NONE 

not set

SES_PRST_WAITING 

waiting

SES_PRST_DONE 

done

◆ ses_state_t

Session States.

Enumerator
SES_ST_NONE 

not set

SES_ST_INIT 

initialization state

SES_ST_HELLO_WAIT 

waiting for peer <hello>

SES_ST_XRD_WAIT 

RESTCONF Entry point processing.

SES_ST_RESTCAPS_WAIT 

RESTCONF Capabilities processing.

SES_ST_IDLE 

adble to accept requests

SES_ST_IN_MSG 

processing a request

SES_ST_SHUTDOWN_REQ 

session shutdown requested

SES_ST_SHUTDOWN 

session shutting down

◆ ses_term_reason_t

Session Termination reason.

Enumerator
SES_TR_NONE 

not set

SES_TR_CLOSED 

close-session

SES_TR_KILLED 

kill-session

SES_TR_DROPPED 

dropped by remote peer

SES_TR_TIMEOUT 

inactivity timeout

SES_TR_OTHER 

other

SES_TR_BAD_START 

bad session start

SES_TR_BAD_HELLO 

bad <hello> received

◆ ses_transport_t

NETCONF Transport Types.

Enumerator
SES_TRANSPORT_NONE 

not set

SES_TRANSPORT_SSH 

NETCONF over SSH (RFC 4742 and 6242)

SES_TRANSPORT_BEEP 

not used

SES_TRANSPORT_SOAP 

not used

SES_TRANSPORT_SOAPBEEP 

not used

SES_TRANSPORT_TLS 

YANGAPI/RESTCONF over TLS.

SES_TRANSPORT_TCP_TAILF 

tail-f NETCONF over TCP

SES_TRANSPORT_TCP_NCX 

YumaWorks NETCONF over TCP.

SES_TRANSPORT_HTTP 

YumaPro REST API ncxconnect, no framing.

SES_TRANSPORT_CLI 

YumaPro CLI hook (ncxconnect, NETCONF framing)

SES_TRANSPORT_WEBUI 

not used YumaPro WEBui (ncxconnect, no framing)

SES_TRANSPORT_AFLOCAL 

ncxserver.sock AF_LOCAL socket – control msg

SES_TRANSPORT_COAP 

CoAP UDP socket.

SES_TRANSPORT_SNMP 

SNMP UDP socket.

SES_TRANSPORT_NETCONF_TLS 

NETCONF over TLS.

SES_TRANSPORT_GNMI 

GNMI Internal processing over RESTCONF.

◆ ses_type_t

enum ses_type_t

Session Types.

Enumerator
SES_TYP_NONE 

not set

SES_TYP_NETCONF 

any network configuration protocol

SES_TYP_DUMMY 

internal session for rollback, etc.

SES_TYP_YCONTROL 

internal YControl session w/ subsystem

SES_TYP_COAP 

RESTCONF over CoAP; static socket, libcoap.

SES_TYP_SNMP 

RESTCONF over SNMP.

SES_TYP_GNMI 

RESTCONF over GNMI.

◆ ses_ypmode_t

YANG-PATCH Mode.

Enumerator
SES_YPMODE_NONE 

not set

SES_YPMODE_HA 

YP-HA mode.

SES_YPMODE_RESTCONF 

RESTCONF mode.

SES_YPMODE_NETCONF 

NETCONF mode.