47#include <sys/socket.h>
67#if defined(WITH_SNMP) && defined(WITH_RESTCONF)
68#include <net-snmp/net-snmp-config.h>
71#include <net-snmp/net-snmp-features.h>
74#include <net-snmp/net-snmp-includes.h>
101#define SES_SOCKADDR_BUFFLEN 128
107#define SES_PRINTADDR_BUFFLEN 50
120#define SES_MY_SID(S) ((S)->sid)
123#define SES_MY_FD(S) ((S)->fd)
126#define SES_MY_USERNAME(S) ((S)->username)
129#define SES_KILLREQ_SET(S) ((S)->state >= SES_ST_SHUTDOWN_REQ)
132#define SES_ACK_KILLREQ(S) ((S)->state = SES_ST_SHUTDOWN)
135#define SES_OUT_BYTES(S) (S)->stats.out_bytes
138#define SES_LINELEN(S) (S)->stats.out_line
141#define SES_LINESIZE(S) (S)->linesize
144#define SES_BUFFSIZE(S) (S)->session_buffsize
147#define SES_IN_ENCODING(S) (S)->in_encoding
150#define SES_OUT_ENCODING(S) (S)->out_encoding
153#define SES_IS_DUMMY(S) ((S)->sid == 0)
156#define SES_IS_YCONTROL(S) ((S)->ycontrol)
159#define SES_CONN_CLOSED(S) (S)->conn_closed
162#define SES_SET_CUR_RPC_MSG(S,MSG) (S)->cur_rpc_msg = MSG
165#define SES_GET_CUR_RPC_MSG(S) (S)->cur_rpc_msg
168#define SES_GET_JSON_1LINE(S) (S)->json_1line
171#define SES_USE_JSON_ATTRS(S) (S)->json_attrs
174#define SES_SET_JSON_ATTRS(S) (S)->json_attrs = TRUE
177#define SES_SET_LEAFLIST_PTR(S,V) (S)->leaflist = V
180#define SES_GET_LEAFLIST_PTR(S) (S)->leaflist
183#define SES_SET_LEAFLIST_ATTRS(S,A) (S)->any_leaflist_attrs = A
186#define SES_GET_LEAFLIST_ATTRS(S) (S)->any_leaflist_attrs
189#define SES_KEEP_XMLNS(S) (S)->keep_xmlns
192#define SES_RAWXML_MODE(S) (S)->rawxml_mode
195#define SES_STATE(S) (S)->state
198#define SES_PEERADDR(S) (S)->peeraddr
201#define SES_PEERPORT(S) (S)->peerport
204#define SES_TRANSPORT(S) (S)->transport
207#define SES_PROTOCOL(S) (S)->protocol
210#define SES_IS_IPV6(S) (S)->is_ipv6
213#define SES_IS_CALLHOME(S) (S)->is_callhome
216#define SES_TYPE(S) (S)->type
219#define SES_GET_COOKIE(S) (S)->get_cookie
222#define SES_BREADCRUMBQ(S) &(S)->breadcrumbQ
225#define SES_CURMSG(S) (S)->curmsg
228#define SES_START_TLS(S) (S)->start_tls
231#define SES_WILDCARD_OK(S) (S)->wildcard_ok
234#define SES_MGRCB(S) (S)->mgrcb
237#define SES_NOTIF_ACTIVE(S) (S)->notif_active
240#define SES_RFC8639_NOTIF_COUNT(S) (S)->rfc8639_notif_cnt
246#define SES_BINARY_NOTIFS(S) (S)->binary_notifs
251#define BINLOG (const xmlChar *)"***binary***"
254#define SES_RDFN(S) (S)->rdfn
257#define SES_WRFN(S) (S)->wrfn
261#define SES_SENDHOOK_FN(S) (S)->sendhook_fn
269#define SES_LAST_OUTBUFF(S) (S)->last_outbuff
275#define SES_SKIP_OUTMSG(S) (S)->skip_outmsg
281#define SES_CALLHOME_NAME(S) (S)->callhome_name
289#define SES_FREE_PENDING(S) (S)->free_pending
296#define SES_RCVR_CB(S) (S)->rcvr_cb
302#define SES_CUR_DSCP(S) (S)->cur_dscp
306#define SES_NULL_SID 0
324#define SES_MSG_BUFFSIZE 9000
330#define SES_MAX_BUFFERS 500000
334#define SES_MAX_FREE_BUFFERS 4
336#define SES_MAX_FREE_BUFFERS 32
340#define SES_MAX_BUFFSEND 32
343#define SES_MAX_BYTESEND 0xffff
346#define SES_DEF_LINESIZE 72
349#define SES_MAX_STARTCHUNK_SIZE 13
352#define SES_MAX_CHUNKNUM_SIZE 10
365#define SES_STARTCHUNK_PAD 10
370#define SES_ENDCHUNK_PAD 8
376#define SES_READBUFF_SIZE SES_MSG_BUFFSIZE
382#define SES_UDPNOTIF_READBUFF_SIZE 65532
385#define SES_GET_YPMODE(S) (S)->yp_mode
388#define SES_SET_YPMODE(S,V) (S)->yp_mode = V
391#define SES_REMOTE_WAIT(S) (S)->remote_wait
394#define SES_NEED_FILE_OVERRIDE(S) ((S)->file_override && (S)->fp)
397#define SES_SYSTEM_USERNAME NCX_EL_SYSTEM
410typedef enum ses_ypmode_t_ {
419typedef enum ses_type_t_ {
432typedef enum ses_transport_t_ {
446 SES_TRANSPORT_COAP_DTLS,
455typedef enum ses_state_t_ {
469typedef enum ses_instate_t_ {
480typedef enum ses_mode_t_ {
491typedef enum ses_term_reason_t_ {
504typedef enum ses_prolog_state_t_ {
518typedef struct ses_stats_t_ {
549typedef struct ses_total_stats_t_ {
577typedef struct ses_msg_buff_t_ {
607typedef struct ses_ready_t_ {
623typedef struct ses_msg_t_ {
711typedef struct ses_udpnotif_cb_t_ {
729 xmlChar curmsg_addr[SES_SOCKADDR_BUFFLEN];
759typedef struct ses_cb_t_ {
858 struct yangapi_cb_t_ *
rcb;
1107#if defined(WITH_SNMP) && defined(WITH_RESTCONF)
1172 const xmlChar *str);
1234 const xmlChar *str);
1442extern const xmlChar *
1478 const xmlChar *fname);
1490 const xmlChar *fname);
1502 const xmlChar *fname);
1543extern const xmlChar *
1555extern const xmlChar *
1638 boolean rawxml_mode);
1654 boolean rawxml_mode,
1655 boolean keep_xmlns);
1671 boolean rawxml_mode);
1687 boolean rawxml_mode,
1688 boolean keep_xmlns);
1733 int32 indent_amount);
1762 uint32 fillbuffsize,
1895extern const xmlChar *
1908 const xmlChar *point);
1972 struct obj_template_t_ *obj);
2004 const xmlChar *filespec,
2040 uint32 *checksum_cnt);
2125extern const xmlChar *
2135extern const xmlChar *
dlq provides general double-linked list and queue support:
status_t
global error return code
Definition: status_enum.h:219
const xmlChar * ses_get_scb_client_addr(ses_cb_t *scb)
Get the client addr to use from an SCB.
Definition: ses.c:6023
void ses_putjstr(ses_cb_t *scb, const xmlChar *str, int32 indent)
write JSON safe content string Write a zero-terminated element content string to the session
Definition: ses.c:3198
void ses_set_out_encoding(ses_cb_t *scb, ncx_display_mode_t encoding)
Set the output encoding.
Definition: ses.c:4759
void ses_free_scb(ses_cb_t *scb)
Free a session control block.
Definition: ses.c:2629
int32 ses_indent_count(const ses_cb_t *scb)
Get the logging indent count for this session.
Definition: ses.c:3299
void ses_start_checksum(ses_cb_t *scb)
Clear the checksum field and start checksum mode.
Definition: ses.c:5681
void ses_start_msg_mode(ses_cb_t *scb)
Set the message output mode to active.
Definition: ses.c:3439
boolean ses_protocol_requested(ses_cb_t *scb, ncx_protocol_t proto)
check if the NETCONF protocol version was requested
Definition: ses.c:4584
void ses_set_grpc_session(ses_cb_t *scb)
Set the specified session as a gRPC session.
Definition: ses.c:5849
void ses_set_gnmi_session(ses_cb_t *scb)
Set the specified session as a gNMI session.
Definition: ses.c:5470
uint32 ses_line_left(const ses_cb_t *scb)
Get the number of bytes that can be added to the current line before the session linesize limit is re...
Definition: ses.c:4096
void ses_set_mode(ses_cb_t *scb, ses_mode_t mode)
Set the output mode for the specified session.
Definition: ses.c:3395
void ses_put_extern(ses_cb_t *scb, const xmlChar *fname)
write the contents of a file to the session
Definition: ses.c:4118
boolean ses_is_control_session(ses_cb_t *scb)
Check if the specified session is a control session.
Definition: ses.c:5071
void ses_set_extern_xml_mode_ex(ses_cb_t *scb, boolean rawxml_mode, boolean keep_xmlns)
Setup the scb for external XML parsing.
Definition: ses.c:4671
boolean ses_is_dbapi_session(ses_cb_t *scb)
Check if the specified session is a DB-API control session.
Definition: ses.c:5114
void ses_finish_msg(ses_cb_t *scb)
Finish an outbound message on the specified session.
Definition: ses.c:3550
void ses_put_binstr(ses_cb_t *scb, const xmlChar *str, uint32 len)
Write a binary string to the session.
Definition: ses.c:2950
void ses_puthstr(ses_cb_t *scb, const xmlChar *str)
write HTML element safe content string Write a zero-terminated element content string to the session
Definition: ses.c:3064
void ses_clear_extern_xml_mode(ses_cb_t *scb, boolean rawxml_mode)
Clear the scb from external XML parsing.
Definition: ses.c:4706
ncx_withdefaults_t ses_withdef(const ses_cb_t *scb)
Get the with-defaults value for this session.
Definition: ses.c:4072
ncx_display_mode_t ses_get_out_encoding(ses_cb_t *scb)
Get the output encoding.
Definition: ses.c:4807
void ses_putstr_indent(ses_cb_t *scb, const xmlChar *str, int32 indent)
Write a zero-terminated content string to the session with indentation.
Definition: ses.c:2984
status_t ses_start_msg(ses_cb_t *scb)
Start a new outbound message on the specified session.
Definition: ses.c:3481
status_t ses_set_protocol(ses_cb_t *scb, ncx_protocol_t proto)
set the NETCONF protocol version in use
Definition: ses.c:4439
void ses_free_xml_reader(ses_cb_t *scb)
Free the xmlTextReader for the session The encoding is switching from XML to something else.
Definition: ses.c:4864
void ses_clear_dbapi_system_session(ses_cb_t *scb)
Clear a session of the DB-API system status.
Definition: ses.c:5198
const xmlChar * ses_state_name(ses_state_t state)
Get the name of a session state from the enum value.
Definition: ses.c:4030
const xmlChar * ses_get_entry_point(ses_cb_t *scb)
Get the RESTCONF entry_point.
Definition: ses.c:5359
status_t ses_set_file_override(ses_cb_t *scb, const xmlChar *filespec, boolean is_binary)
Setup the session in file write override mode.
Definition: ses.c:5619
ncx_protocol_t ses_get_protocol(const ses_cb_t *scb)
Get the NETCONF protocol set (or unset) for this session.
Definition: ses.c:4515
int32 ses_new_indent_count(boolean indent_in, int32 indent, int32 indent_amount)
Get the new indent count from the current and indent_amount.
Definition: ses.c:4832
ses_cb_t * ses_new_snmp_scb(void)
Create a new global SNMP session control block.
Definition: ses.c:2593
int32 ses_message_indent_count(const ses_cb_t *scb)
Get the message indent count for this session.
Definition: ses.c:3320
xmlChar * ses_get_outbuff(ses_cb_t *scb)
Get the session outbuffer character array.
Definition: ses.c:6069
const xmlChar * ses_get_scb_username(ses_cb_t *scb)
Get the username to use from an SCB.
Definition: ses.c:6000
status_t ses_set_gnmi_control_session(ses_cb_t *scb)
Set the specified session as a gNMI control session.
Definition: ses.c:5421
ses_transport_t ses_get_transport_enum(const xmlChar *str)
Get the enum value for the yumaworks-types:transport-type.
Definition: ses.c:4358
void ses_stop_msg_mode(ses_cb_t *scb)
Set the message output mode to inactive.
Definition: ses.c:3459
void ses_putstr(ses_cb_t *scb, const xmlChar *str)
Write a zero-terminated string to the session.
Definition: ses.c:2927
status_t ses_put_extern_bin(ses_cb_t *scb, const xmlChar *fname)
write the contents of a binary file to the session
Definition: ses.c:4177
void ses_indent(ses_cb_t *scb, int32 indent)
Write the proper newline + indentation to the specified session.
Definition: ses.c:3266
status_t ses_set_entry_point(ses_cb_t *scb, const xmlChar *point)
Set the RESTCONF entry_point.
Definition: ses.c:5387
boolean ses_notifications_active(const ses_cb_t *scb)
Check if the session has notifications active.
Definition: ses.c:5514
ses_total_stats_t * ses_get_total_stats(void)
Get a r/w pointer to the the session totals stats.
Definition: ses.c:4214
void ses_init_coap_scb(ses_cb_t *scb)
Initialize a CoAP session control block.
Definition: ses.c:2555
void ses_set_indent(ses_cb_t *scb, int32 indent)
Set the logging indent count for this session.
Definition: ses.c:3338
const xmlChar * ses_get_transport_name(ses_transport_t transport)
Get the name of the transport for a given enum value.
Definition: ses.c:4252
boolean ses_poll_ready(ses_cb_t *scb)
Check if the specified session is ready to read bytes.
Definition: ses.c:5950
void ses_set_dbapi_system_session(ses_cb_t *scb)
Set the specified session as a DB-API control session for system edits.
Definition: ses.c:5157
boolean ses_is_grpc_control_session(ses_cb_t *scb)
Check if the specified session is a gRPC control session.
Definition: ses.c:5824
size_t ses_get_outbuff_len(const ses_cb_t *scb)
Get the current outbuffer length for the session.
Definition: ses.c:6045
void ses_clean_breadcrumbQ(ses_cb_t *scb)
Clean the breadcrumbQ.
Definition: ses.c:5575
status_t ses_accept_input(ses_cb_t *scb)
The IO input handler for the ncxserver loop.
Definition: ses.c:3772
boolean ses_dropped(const ses_cb_t *scb)
Check if the session has been dropped by the client.
Definition: ses.c:5597
status_t ses_set_control_session(ses_cb_t *scb)
Set the specified session as a control session.
Definition: ses.c:5049
void ses_putcstr(ses_cb_t *scb, const xmlChar *str, int32 indent)
write XML element safe content string Write a zero-terminated element content string to the session
Definition: ses.c:3020
void ses_putastr(ses_cb_t *scb, const xmlChar *str, int32 indent)
write XML attribute safe content string Write a zero-terminated attribute content string to the sessi...
Definition: ses.c:3144
ses_cb_t * ses_new_udpnotif_scb(void)
Create a new session control block for UDP-Notif Collector.
Definition: ses.c:2477
ses_cb_t * ses_new_coap_scb(void)
Create a new global CoAP session control block.
Definition: ses.c:2534
status_t ses_add_breadcrumb_obj(ses_cb_t *scb, struct obj_template_t_ *obj)
Add an object to the breadcrumbQ.
void ses_putchar(ses_cb_t *scb, uint32 ch)
Write one char to the session, without any translation.
Definition: ses.c:2874
boolean ses_get_xml_nons(const ses_cb_t *scb)
force xmlns attributes to be skipped in XML mode
Definition: ses.c:4420
void ses_set_protocols_requested(ses_cb_t *scb, ncx_protocol_t proto)
set the NETCONF protocol versions requested
Definition: ses.c:4538
void ses_set_message_indent(ses_cb_t *scb, int32 indent)
Set the message indent count for this session.
Definition: ses.c:3367
void ses_putcchar(ses_cb_t *scb, uint32 ch)
Write one content char to the session, with translation as needed.
Definition: ses.c:3102
status_t ses_start_http_chunk_mode(ses_cb_t *scb)
Start outputting buffers in HTTP 1.1 chunk mode.
Definition: ses.c:5320
ncx_msg_encoding_t ses_get_msg_encoding(const ses_cb_t *scb)
Get the message encoding for the HTTP session.
Definition: ses.c:5298
int32 ses_add_indent(ses_cb_t *scb, int32 indent)
Add in the new indent amount.
Definition: ses.c:5222
ses_transport_t ses_get_transport(ses_cb_t *scb)
Get the transport enum for a given session.
Definition: ses.c:4232
int ses_read_cb(void *context, char *buffer, int len)
The IO input front-end for the xmlTextReader parser read fn.
Definition: ses.c:3645
void ses_set_xml_nons(ses_cb_t *scb)
force xmlns attributes to be skipped in XML mode
Definition: ses.c:4400
void ses_clear_extern_xml_mode_ex(ses_cb_t *scb, boolean rawxml_mode, boolean keep_xmlns)
Clear the scb from external XML parsing.
Definition: ses.c:4730
void ses_set_SSE_encoding(ses_cb_t *scb)
Set the output encoding to have a Server Sent Events filter Used for notification delivery over RESTC...
Definition: ses.c:4781
boolean ses_is_dbapi_system_session(ses_cb_t *scb)
Check if the specified session is a DB-API control session for system edits.
Definition: ses.c:5179
int32 ses_dec_indent(ses_cb_t *scb, int32 indent)
Remove the specified indent amount.
Definition: ses.c:5259
status_t ses_getline_cb(xmlChar *fillbuff, uint32 fillbuffsize, void *cookie)
The IO input front-end for the tk_parse_json_buffs function.
Definition: ses.c:4899
void ses_set_dbapi_session(ses_cb_t *scb)
Set the specified session as a DB-API control session.
Definition: ses.c:5092
boolean ses_is_gnmi_control_session(ses_cb_t *scb)
Check if the specified session is a gNMI control session.
Definition: ses.c:5445
ses_cb_t * ses_new_dummy_scb(void)
Create a new dummy session control block.
Definition: ses.c:2502
uint32 ses_finish_checksum(ses_cb_t *scb, uint32 *checksum_cnt)
Stop checksum mode and return the final checksum.
Definition: ses.c:5711
boolean ses_is_grpc_session(ses_cb_t *scb)
Check if the specified session is a gRPC session.
Definition: ses.c:5871
boolean ses_is_system_session(ses_cb_t *scb)
Check if the specified session is an internal system session.
Definition: ses.c:5135
void ses_set_extern_xml_mode(ses_cb_t *scb, boolean rawxml_mode)
Setup the scb for external XML parsing.
Definition: ses.c:4648
boolean ses_dropped_ex(ses_cb_t *scb)
Check if the session has been dropped by the client.
Definition: ses.c:5751
const xmlChar * ses_get_transport_yang_name(ses_transport_t transport)
Get the name of the transport for a given enum value.
Definition: ses.c:4312
status_t ses_set_grpc_control_session(ses_cb_t *scb)
Set the specified session as a gRPC control session.
Definition: ses.c:5800
status_t ses_put_extern2(ses_cb_t *scb, const xmlChar *fname)
write the contents of a file to the session
Definition: ses.c:4141
void ses_dump_binary_buff(const xmlChar *buff, size_t bufflen)
Dump some bytes from the binary buffer (max 256)
Definition: ses.c:5895
status_t ses_set_setup_cb(ses_cb_t *scb, ses_setup_fn_t fn, void *cookie)
Set the setup handler callback for UDP-Notif.
Definition: ses.c:6092
ses_cb_t * ses_new_scb(void)
Create a new session control block.
Definition: ses.c:2460
ses_mode_t ses_get_mode(ses_cb_t *scb)
Get the output mode for the specified session.
Definition: ses.c:3416
boolean ses_is_gnmi_session(ses_cb_t *scb)
Check if the specified session is a gNMI session.
Definition: ses.c:5492
void ses_clear_file_override(ses_cb_t *scb)
Cleanup the session in file write override mode Does not delete the file, just closes it!
Definition: ses.c:5655
void ses_put_binchar(ses_cb_t *scb, uint32 ch)
Write one binary char to the session, without any translation.
Definition: ses.c:2900
status_t(* ses_write_fn_t)(void *s)
optional write function for the session
Definition: ses.h:667
ses_transport_t
NETCONF Transport Types.
Definition: ses.h:432
ses_ypmode_t
YANG-PATCH Mode.
Definition: ses.h:410
ses_state_t
Session States.
Definition: ses.h:455
status_t(* ses_sendhook_fn_t)(void *s, boolean start)
optional send message start/end callback function
Definition: ses.h:687
ses_mode_t
Session Output Mode.
Definition: ses.h:480
ses_term_reason_t
Session Termination reason.
Definition: ses.h:491
ses_type_t
Session Types.
Definition: ses.h:419
ses_instate_t
Session Input Handler States for base:1.0 EOM processing.
Definition: ses.h:469
uint32 ses_id_t
Session ID.
Definition: ses.h:407
status_t(* ses_setup_fn_t)(void *s, void *cookie)
(UDP-Notif) session setup callback
Definition: ses.h:702
#define SES_MSG_BUFFSIZE
controls the size of each buffer chunk
Definition: ses.h:324
#define SES_MAX_STARTCHUNK_SIZE
max size of a valid base:1.1 chunk header start tag
Definition: ses.h:349
ses_prolog_state_t
prolog parsing state
Definition: ses.h:504
ssize_t(* ses_read_fn_t)(void *s, char *buff, size_t bufflen, bool *erragain)
optional read function for the session
Definition: ses.h:655
@ SES_TRANSPORT_UDPNOTIF
UDP-Notif Protocol.
Definition: ses.h:450
@ SES_TRANSPORT_TCP_TAILF
tail-f NETCONF over TCP
Definition: ses.h:439
@ SES_TRANSPORT_BEEP
not used
Definition: ses.h:435
@ SES_TRANSPORT_COAP
CoAP UDP socket.
Definition: ses.h:445
@ SES_TRANSPORT_CLI
YumaPro CLI hook (ncxconnect, NETCONF framing)
Definition: ses.h:442
@ SES_TRANSPORT_NETCONF_TLS
NETCONF over TLS.
Definition: ses.h:448
@ SES_TRANSPORT_WEBUI
not used YumaPro WEBui (ncxconnect, no framing)
Definition: ses.h:443
@ SES_TRANSPORT_SOAP
not used
Definition: ses.h:436
@ SES_TRANSPORT_SNMP
SNMP UDP socket.
Definition: ses.h:447
@ SES_TRANSPORT_NONE
not set
Definition: ses.h:433
@ SES_TRANSPORT_SSH
NETCONF over SSH (RFC 4742 and 6242)
Definition: ses.h:434
@ SES_TRANSPORT_TLS
YANGAPI/RESTCONF over TLS.
Definition: ses.h:438
@ SES_TRANSPORT_AFLOCAL
ncxserver.sock AF_LOCAL socket – control msg
Definition: ses.h:444
@ SES_TRANSPORT_GNMI
GNMI Internal processing over RESTCONF.
Definition: ses.h:449
@ SES_TRANSPORT_HTTP
YumaPro REST API ncxconnect, no framing.
Definition: ses.h:441
@ SES_TRANSPORT_SOAPBEEP
not used
Definition: ses.h:437
@ SES_TRANSPORT_TCP_NCX
YumaWorks NETCONF over TCP.
Definition: ses.h:440
@ SES_YPMODE_RESTCONF
RESTCONF mode.
Definition: ses.h:413
@ SES_YPMODE_HA
YP-HA mode.
Definition: ses.h:412
@ SES_YPMODE_NONE
not set
Definition: ses.h:411
@ SES_YPMODE_NETCONF
NETCONF mode.
Definition: ses.h:414
@ SES_ST_IN_MSG
processing a request
Definition: ses.h:462
@ SES_ST_HELLO_WAIT
waiting for peer <hello>
Definition: ses.h:458
@ SES_ST_INIT
initialization state
Definition: ses.h:457
@ SES_ST_IDLE
adble to accept requests
Definition: ses.h:461
@ SES_ST_NONE
not set
Definition: ses.h:456
@ SES_ST_SHUTDOWN_REQ
session shutdown requested
Definition: ses.h:463
@ SES_ST_SHUTDOWN
session shutting down
Definition: ses.h:464
@ SES_ST_XRD_WAIT
RESTCONF Entry point processing.
Definition: ses.h:459
@ SES_ST_RESTCAPS_WAIT
RESTCONF Capabilities processing.
Definition: ses.h:460
@ SES_MODE_TEXT
text mode
Definition: ses.h:485
@ SES_MODE_BINARY
binary mode
Definition: ses.h:486
@ SES_MODE_HTML
HTML mode.
Definition: ses.h:484
@ SES_MODE_XMLDOC
XML documentation mode.
Definition: ses.h:483
@ SES_MODE_NONE
not set
Definition: ses.h:481
@ SES_MODE_XML
XML mode.
Definition: ses.h:482
@ SES_TR_CLOSED
close-session
Definition: ses.h:493
@ SES_TR_NONE
not set
Definition: ses.h:492
@ SES_TR_BAD_START
bad session start
Definition: ses.h:498
@ SES_TR_KILLED
kill-session
Definition: ses.h:494
@ SES_TR_TIMEOUT
inactivity timeout
Definition: ses.h:496
@ SES_TR_DROPPED
dropped by remote peer
Definition: ses.h:495
@ SES_TR_OTHER
other
Definition: ses.h:497
@ SES_TR_BAD_HELLO
bad <hello> received
Definition: ses.h:499
@ SES_TYP_NONE
not set
Definition: ses.h:420
@ SES_TYP_NETCONF
any network configuration protocol
Definition: ses.h:421
@ SES_TYP_COAP
RESTCONF over CoAP; static socket, libcoap.
Definition: ses.h:424
@ SES_TYP_GNMI
RESTCONF over GNMI.
Definition: ses.h:426
@ SES_TYP_YCONTROL
internal YControl session w/ subsystem
Definition: ses.h:423
@ SES_TYP_UDPNOTIF
UDP-Notif Publisher or Subscriber.
Definition: ses.h:427
@ SES_TYP_DUMMY
internal session for rollback, etc.
Definition: ses.h:422
@ SES_TYP_SNMP
RESTCONF over SNMP.
Definition: ses.h:425
@ SES_INST_INMSG
in message body
Definition: ses.h:472
@ SES_INST_NONE
not set
Definition: ses.h:470
@ SES_INST_INSTART
starting in the EOM field
Definition: ses.h:473
@ SES_INST_IDLE
idle state
Definition: ses.h:471
@ SES_INST_INEND
ending the EOM field
Definition: ses.h:475
@ SES_INST_INBETWEEN
in between 2 messages
Definition: ses.h:474
@ SES_PRST_WAITING
waiting
Definition: ses.h:506
@ SES_PRST_DONE
done
Definition: ses.h:507
@ SES_PRST_NONE
not set
Definition: ses.h:505
#define TSTAMP_MIN_SIZE
normal minimum buffer size for a tstamp buffer
Definition: tstamp.h:71
ncx_msg_encoding_t
enumeration for message encoding formats
Definition: ncxtypes.h:648
ncx_protocol_t
NCX session protocol versions supported.
Definition: ncxtypes.h:980
ncx_display_mode_t
enumeration of val_dump_value display modes Some RESTCONF code uses this field incorrectly for messag...
Definition: ncxtypes.h:618
ncx_withdefaults_t
enum for with-defaults enum values
Definition: ncxtypes.h:1259
YANG module data structures Many internal representations of YANG module constructs.
Global error messages for status code enumerations.
Session Control Block.
Definition: ses.h:759
boolean content_length_based
content len based msg body
Definition: ses.h:892
boolean rawxml_mode
T: expand_anyxml, F: normal.
Definition: ses.h:794
ses_read_fn_t rdfn
set if external write fn
Definition: ses.h:836
boolean framing11
T: base:1.1, F: base:1.0.
Definition: ses.h:791
xmlChar * readbuff
input buffer for session
Definition: ses.h:868
uint32 checksum
running checksum for YANG Push Simulated Operational mode
Definition: ses.h:954
uint32 freecnt
current freeQ count
Definition: ses.h:847
boolean http_chunk_mode
T: send HTTP chunks, F: normal.
Definition: ses.h:807
boolean locks_released
Signal release point in kill.
Definition: ses.h:784
boolean binary_notifs
Flag to indicate Binary Notification Messages are expected to be received on this session.
Definition: ses.h:978
uint32 linesize
TERM line length.
Definition: ses.h:874
ses_msg_t * curmsg
pointer to current message to read set by agt only
Definition: ses.h:933
xmlChar * callhome_name
set for server NETCONF over TLS callhome sessions so the callhome reconnect can be checked when the s...
Definition: ses.h:990
void * openssl_ssl
malloced with SSL_new
Definition: ses.h:913
xmlChar * username
user ID
Definition: ses.h:775
boolean direct_mode
T: yp-shell, F: normal.
Definition: ses.h:795
boolean is_ipv6
T: using IPv6 address, F: IPv4.
Definition: ses.h:812
boolean sse_mode
T: Server Sent Events, F: normal.
Definition: ses.h:800
struct rpc_msg_t_ * cur_rpc_msg
for SIL-SA get callback
Definition: ses.h:856
size_t session_buffsize
the session_buffsize parameter is usually based on the ncx_get_chunk_size function which is set from ...
Definition: ses.h:998
uint32 readbuffsize
input buffer size
Definition: ses.h:869
boolean skip_outmsg
UDP-Notif Send function needs to keep a 'skip' state to dkip messages that need to be segmented,...
Definition: ses.h:1021
dlq_hdr_t breadcrumbQ
Queue of breadcrumb object back pointers used in XPath GET2 processing of when-stmts in operational s...
Definition: ses.h:930
dlq_hdr_t freeQ
Q of ses_msg_buff_t.
Definition: ses.h:849
uint32 checksum_cnt
byte count
Definition: ses.h:955
boolean stream_output
buffer/stream svr
Definition: ses.h:789
boolean msg_mode
T:msg-indent F:indent.
Definition: ses.h:796
boolean ypgnmi
T: is gNMI ycontrol session.
Definition: ses.h:801
boolean active
<hello> completed ok
Definition: ses.h:787
ses_id_t sid
session ID
Definition: ses.h:768
boolean json_1line
T: output JSON leaf-list on 1 line.
Definition: ses.h:806
uint32 cache_timeout
vir-val cache tmr in sec
Definition: ses.h:876
ses_stats_t stats
per-session statistics
Definition: ses.h:854
ses_ready_t outready
header for outreadyQ
Definition: ses.h:853
boolean reading_header
variables for SSL sessions; used by yangcli-pro
Definition: ses.h:891
boolean dbapi_system
T: is DB-API system session.
Definition: ses.h:799
boolean skip_modnames
YPW-888: new restconf cli parameter to turn strict JSON YANG enconding off, do not include module nam...
Definition: ses.h:910
boolean start_tls
T: need to start TLS session first.
Definition: ses.h:816
boolean wildcard_ok
set by yangcli when parsing an XML file and wildcard strings are allowed; read by mgr_val_parse check...
Definition: ses.h:939
uint32 inendpos
inside framing directive
Definition: ses.h:844
int32 total_length
total length
Definition: ses.h:894
boolean use_traceid
TRUE if OK to use Trace ID attr in the RPC calls.
Definition: ses.h:897
struct agt_acm_cache_t_ * acm_cache
agent access control for database reads and writes; for incoming agent <rpc> requests,...
Definition: ses.h:885
ses_ready_t inready
header for inreadyQ
Definition: ses.h:852
ncx_withdefaults_t withdef
with-defaults default
Definition: ses.h:875
ses_msg_buff_t * outbuff
current output buffer
Definition: ses.h:851
void * get_cookie
this pointer available to pass a cookie to a GET1 callback will not be freed when the scb is deleted
Definition: ses.h:918
dlq_hdr_t qhdr
queued by manager only
Definition: ses.h:760
boolean http_waitrn
T: wait for EOchunk, F: no wait.
Definition: ses.h:808
ses_write_fn_t wrfn
set if external read fn
Definition: ses.h:837
int8 indent
indent N spaces (0..9)
Definition: ses.h:872
ses_mode_t mode
session mode
Definition: ses.h:767
int fd
set if output to a socket
Definition: ses.h:835
int8 msg_indent
indent N spaces (-1..9)
Definition: ses.h:873
boolean ycontrol
T: is ycontrol session.
Definition: ses.h:797
boolean checksum_mode
T: add out byte to checksum.
Definition: ses.h:817
dlq_hdr_t snmp_getnext_listQ
SNMP pointers Q of malloced val_value struct Q of list entries with only keys in it.
Definition: ses.h:966
uint32 yang_sid_tree
SID Tree Assignment for this session.
Definition: ses.h:983
struct cfg_template_t_ * fake_candidate
a fake candidate config for target=running YANG-PATCH
Definition: ses.h:948
boolean warn_xml
T: xml warns, F: no warn.
Definition: ses.h:793
uint32 buffcnt
current buffer count
Definition: ses.h:846
uint8 cur_dscp
UDP-Notif YANG-Push sessions can set the DSCP for the publisher output.
Definition: ses.h:1008
boolean restconf_sse_mode
T: RESTCONF SSE mode.
Definition: ses.h:803
uint32 protocols_requested
bitmask
Definition: ses.h:762
uint16 rfc8639_notif_cnt
New subscriptions allow more than 1 per session.
Definition: ses.h:951
int tid
Thread ID representing session.
Definition: ses.h:782
xmlChar * service_name
variables for ycontrol sessions
Definition: ses.h:888
ncx_protocol_t protocol
protocol version in use
Definition: ses.h:763
boolean is_callhome
T: callhome session.
Definition: ses.h:813
FILE * fp
set if output to a file
Definition: ses.h:834
ses_sendhook_fn_t sendhook_fn
set if Send Hook Callback used: internal for UDP-Notif Publisher session.
Definition: ses.h:842
uint32 last_ch
save in case cr/lf in SSE mode
Definition: ses.h:818
boolean any_leaflist_attrs
T: leaf-list has attrs.
Definition: ses.h:810
dlq_hdr_t outQ
Q of ses_msg_buff_t.
Definition: ses.h:850
boolean chunk_based
chunked based msg body
Definition: ses.h:893
ses_id_t rollback_sid
session ID for rollback
Definition: ses.h:770
ses_instate_t instate
input state enum
Definition: ses.h:845
ses_udpnotif_cb_t * udpnotif_cb
UDP-Notif Collector control block for this session not used unless client-side SES_TYP_UDPNOTIF Colle...
Definition: ses.h:1032
dlq_hdr_t msgQ
Q of ses_msg_t input.
Definition: ses.h:848
boolean dbapi
T: is DB-API session.
Definition: ses.h:798
struct obj_template_t_ * snmp_table_obj
Current SNMP walk table.
Definition: ses.h:969
ses_state_t state
session state
Definition: ses.h:766
ncx_display_mode_t in_encoding
input encoding can be different in RESTCONF, set by the Content-Type header
Definition: ses.h:824
xmlChar * start_time
dateTime start time
Definition: ses.h:774
boolean restconf_notif
REST SSE notifications in progress.
Definition: ses.h:804
ses_transport_t transport
transport type
Definition: ses.h:764
void * openssl_ctx
backptr to TLS context
Definition: ses.h:912
uint16 peerport
Inet TCP port number.
Definition: ses.h:777
struct val_value_t_ * leaflist
JSON attrs backptr.
Definition: ses.h:819
boolean keep_xmlns
T: parse extern, F: msg
Definition: ses.h:792
ses_ypmode_t yp_mode
YANG-PATCH mode:
Definition: ses.h:904
boolean last_outbuff
UDP-Notif Send function needs to know if ses_finish_msg is sending the last buff or ses_msg_new_outpu...
Definition: ses.h:1014
xmlTextReaderPtr reader
input stream reader
Definition: ses.h:833
void * tcb
Thread control block.
Definition: ses.h:783
ses_type_t type
session type
Definition: ses.h:761
boolean notif_active
subscription active
Definition: ses.h:788
boolean file_override
set by server DB-API session to capture <rpc-reply> output to a file.
Definition: ses.h:945
void * mgrcb
if manager session, mgr_scb_t
Definition: ses.h:855
boolean remote_wait
if there is a remote operation in progress then this flag will be set so new input can be held off on...
Definition: ses.h:924
time_t last_rpc_time
used for idle timeout
Definition: ses.h:773
ses_term_reason_t termreason
termination reason
Definition: ses.h:771
boolean is_ycontrol_scb
T: is ycontrol_scb for HA.
Definition: ses.h:811
boolean free_pending
T: dropped SUBSYS waiting free.
Definition: ses.h:815
boolean noxmlns
xml-nons display-mode
Definition: ses.h:790
xmlChar * subsys_id
used for YCONTROL session only
Definition: ses.h:780
boolean dropped
T: session dropped in a msg.
Definition: ses.h:814
void * rcvr_cb
UDP-Notif Publisher uses 1 SCB for each receiver this is a backptr to the rcvr_cb_t struct in agt/agt...
Definition: ses.h:1027
boolean conn_closed
T: scb IO closed last buffer.
Definition: ses.h:786
xmlChar * peeraddr
Inet address string.
Definition: ses.h:776
time_t hello_time
used for hello timeout
Definition: ses.h:772
boolean json_attrs
T: use JSON attributes.
Definition: ses.h:809
ncx_msg_encoding_t encoding
HTTP msg encoding.
Definition: ses.h:765
ncx_display_mode_t out_encoding
output encoding can be different in RESTCONF, set by the Accept header.
Definition: ses.h:831
boolean ypgrpc
T: is gRPC ycontrol session.
Definition: ses.h:971
xmlChar * entry_point
REST-API entry point.
Definition: ses.h:859
ses_id_t killedbysid
killed-by session ID
Definition: ses.h:769
struct yangapi_cb_t_ * rcb
REST-API control block.
Definition: ses.h:858
Session Message Buffer.
Definition: ses.h:577
size_t buffstart
buff start pos
Definition: ses.h:579
boolean isbinary
T: CBOR, F: XML.
Definition: ses.h:583
dlq_hdr_t qhdr
not set
Definition: ses.h:578
uint32 segment
For UDP-Notif the segment-id is recorded If a segment is biffer than 1 buffer there will be multiple ...
Definition: ses.h:589
size_t buffpos
buff cur position
Definition: ses.h:581
boolean islast
T: last buff in msg.
Definition: ses.h:582
size_t bufflen
buff actual size
Definition: ses.h:580
Session Message.
Definition: ses.h:623
ncx_msg_encoding_t msg_encoding
UDP-Notif Standard Media Type.
Definition: ses.h:634
dlq_hdr_t buffQ
Q of ses_msg_buff_t.
Definition: ses.h:628
size_t curchunksize
cur chunk rcvd
Definition: ses.h:630
size_t expchunksize
expected chunk size
Definition: ses.h:631
boolean dispatched
in processing
Definition: ses.h:626
dlq_hdr_t qhdr
Q header for buffcb->msgQ.
Definition: ses.h:624
boolean ready
ready for parsing
Definition: ses.h:625
ses_prolog_state_t prolog_state
for insert prolog
Definition: ses.h:629
uint32 message_id
UDP-Notif Message-ID.
Definition: ses.h:640
ses_msg_buff_t * curbuff
cur position in buffQ
Definition: ses.h:627
uint32 publisher_id
UDP-Notif Publisher-ID.
Definition: ses.h:637
embedded Q header for the message ready Q The 'inq' flag is used to prevent queue corruption
Definition: ses.h:607
boolean inq
flag that already in the ready Q
Definition: ses.h:615
dlq_hdr_t hdr
< embedded queue header threaded into ready Q
Definition: ses.h:609
ses_id_t sid
session ID of this session
Definition: ses.h:612
boolean ycontrol
flag YControl session for priority processing
Definition: ses.h:618
Per Session Statistics.
Definition: ses.h:518
uint32 inRpcs
netconf-state in-rpcs counter
Definition: ses.h:529
uint32 in_bytes
extra original internal in byte counter
Definition: ses.h:520
uint32 requests
internal request counters for EVAL tracking
Definition: ses.h:544
uint32 outNotifications
netconf-state out-notifications counter
Definition: ses.h:538
uint32 out_line
hack: bytes since ' ', pretty-print
Definition: ses.h:526
uint32 outRpcErrors
netconf-state out-rpc-errors counter
Definition: ses.h:535
uint32 excluded_events
yang-push excluded-events counter
Definition: ses.h:541
uint32 inBadRpcs
netconf-state in-bad-rpcs counter
Definition: ses.h:532
uint32 out_bytes
extra original internal out byte counter
Definition: ses.h:523
Session Total Statistics.
Definition: ses.h:549
uint32 closed_sessions
total closed sessions
Definition: ses.h:554
uint32 inBadHellos
total in bad hello messages
Definition: ses.h:560
ses_stats_t stats
per-session stats added up for all sessions
Definition: ses.h:569
uint32 droppedSessions
total dropped sessions
Definition: ses.h:566
uint32 inSessions
total inbound sessions
Definition: ses.h:563
uint32 failed_sessions
total failed sessions
Definition: ses.h:557
uint32 active_sessions
total active sessions
Definition: ses.h:551
Special UDP-Notif Collector Control Block Used to manage the DGRAM connection where the publishers ar...
Definition: ses.h:711
void * cookie
parameter to send to callback function
Definition: ses.h:748
dlq_hdr_t pubcbQ
UDP-Notif needs a special Queue of publisher control blocks since multiple source addresses can be se...
Definition: ses.h:737
ses_setup_fn_t setup_fn
The session control block setup by udpnotif_init is the collector session listening to the collector ...
Definition: ses.h:745
const xmlChar * curmsg_print_addr
back-pointer to the pubcb->print_addr that matches the curmsg_addr field
Definition: ses.h:753
uint32 curmsg_addrlen
UDP-Notif read function stores the actual sockaddr length.
Definition: ses.h:714