yumapro  20.10-12
YumaPro SDK
agt_connect.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
3  * Copyright (c) 2012 - 2021, YumaWorks, Inc., All Rights Reserved.
4  *
5  * Unless required by applicable law or agreed to in writing,
6  * software distributed under the License is distributed on an
7  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8  * KIND, either express or implied. See the License for the
9  * specific language governing permissions and limitations
10  * under the License.
11  */
12 #ifndef _H_agt_connect
13 #define _H_agt_connect
14 
15 /* FILE: agt_connect.h
16 *********************************************************************
17 * *
18 * P U R P O S E *
19 * *
20 *********************************************************************/
21 
42 /*********************************************************************
43 * *
44 * C H A N G E H I S T O R Y *
45 * *
46 *********************************************************************
47 
48 date init comment
49 ----------------------------------------------------------------------
50 15-jan-07 abb Begun
51 
52 */
53 
54 #ifndef _H_cfg
55 #include "cfg.h"
56 #endif
57 
58 #ifndef _H_status
59 #include "status.h"
60 #endif
61 
62 #ifndef _H_xml_util
63 #include "xml_util.h"
64 #endif
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
70 /********************************************************************
71 * *
72 * F U N C T I O N S *
73 * *
74 *********************************************************************/
75 
98 extern status_t
99  agt_connect_init (void);
100 
101 
107 extern void
108  agt_connect_cleanup (void);
109 
110 
119 extern boolean
120  agt_connect_dispatch (ses_cb_t *scb,
121  xml_node_t *top);
122 
123 
127 #ifdef __cplusplus
128 } /* end extern 'C' */
129 #endif
130 
131 #endif /* _H_agt_connect */
agt_ycontrol_add_subsys
status_t agt_ycontrol_add_subsys(ses_id_t subsys_sid, const xmlChar *subsys_id)
Add a subsystem connection to the ycontrol manager.
Definition: agt_ycontrol.c:1815
ses.h
NETCONF Session Common definitions module.
NCX_SERVER_TRANSPORT_LOCAL
#define NCX_SERVER_TRANSPORT_LOCAL
ncxserver server transport for local connections
Definition: ncxconst.h:165
agt_hello_send
status_t agt_hello_send(ses_cb_t *scb)
Send the server <hello> message to the manager on the specified session.
Definition: agt_hello.c:311
cfg.h
agt_connect_init
status_t agt_connect_init(void)
Initialize the agt_connect module.
Definition: agt_connect.c:187
ERR_NCX_WRONG_NODETYP
@ ERR_NCX_WRONG_NODETYP
282
Definition: status_enum.h:325
agt_restconf.h
IETF RESTCONF Protocol Message Handler.
agt_ses.h
Server Session Management.
NCX_SERVER_TRANSPORT_CLI
#define NCX_SERVER_TRANSPORT_CLI
ncxserver server transport for Yuma CLI connections
Definition: ncxconst.h:171
agt_util.h
Utility Functions for NCX Server method routines.
xml_strdup
xmlChar * xml_strdup(const xmlChar *copyFrom)
String duplicate for xmlChar.
Definition: xml_util.c:1553
agt_state.h
NETCONF State Monitoring Data Model Module support.
SES_ST_IDLE
@ SES_ST_IDLE
adble to accept requests
Definition: ses.h:358
log_error
void log_error(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_ERROR log entry.
val.h
Value Node Basic Support.
xml_util.h
XML Utilities.
log_debug3
void void void void void void void void void void void log_debug3(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG3 log entry.
ncx_num.h
NCX Module Library Number Utility Functions.
ERR_NCX_WRONG_VERSION
@ ERR_NCX_WRONG_VERSION
314
Definition: status_enum.h:357
NCX_SERVER_TRANSPORT_TCP_NCX
#define NCX_SERVER_TRANSPORT_TCP_NCX
ncxserver server transport for local system connections
Definition: ncxconst.h:180
ncx_init_num
void ncx_init_num(ncx_num_t *num)
Init a ncx_num_t struct.
Definition: ncx_num.c:162
NCX_PROTO_YUMA_YANGAPI
@ NCX_PROTO_YUMA_YANGAPI
YumaPro YANG-API 1.0.
Definition: ncxtypes.h:785
NCX_PROTO_YUMA_CLI
@ NCX_PROTO_YUMA_CLI
YumaPro Internal CLI 1.0.
Definition: ncxtypes.h:786
agt_yangapi.h
Yuma REST API Message Handler.
ses_set_gnmi_control_session
status_t ses_set_gnmi_control_session(ses_cb_t *scb)
Set the specified session as a gNMI control session.
Definition: ses.c:4700
yangapi_new_rcb
yangapi_cb_t * yangapi_new_rcb(void)
Create a new YANG-API control block.
Definition: yangapi.c:317
agt_ses_ssh_port_allowed
boolean agt_ses_ssh_port_allowed(uint16 port)
Check if the port number used for SSH connect is okay.
Definition: agt_ses.c:1768
NCX_MODULE
#define NCX_MODULE
Internal Yuma Extensions module.
Definition: ncxconst.h:80
NCX_NF_DEC
@ NCX_NF_DEC
YANG deciaml format.
Definition: ncxtypes.h:335
agt_cb.h
NETCONF Server Data Model callback handler.
log_info
void void void void void log_info(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_INFO log entry.
NCX_SERVER_TRANSPORT_HTTP
#define NCX_SERVER_TRANSPORT_HTTP
ncxserver server transport for Yuma HTTP/REST-API connections
Definition: ncxconst.h:168
log_debug2
void void void void void void void void void log_debug2(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG2 log entry.
agt_yp_ha_mgmt_enabled
boolean agt_yp_ha_mgmt_enabled(void)
Check if MGMT protocols disabled because YP-HA Standby mode.
Definition: agt_yp_ha.c:877
agt_audit_handle_start_session
void agt_audit_handle_start_session(ses_cb_t *scb)
Generate a start (client or control) session event if enabled.
Definition: agt_audit.c:452
agt_in_maintenance_mode
boolean agt_in_maintenance_mode(void)
Return true if in mainenance mode now.
Definition: agt.c:5184
ERR_NCX_MISSING_ATTR
@ ERR_NCX_MISSING_ATTR
309
Definition: status_enum.h:352
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
SES_TRANSPORT_CLI
@ SES_TRANSPORT_CLI
YumaPro CLI hook (ncxconnect, NETCONF framing)
Definition: ses.h:340
SES_MY_USERNAME
#define SES_MY_USERNAME(S)
get username
Definition: ses.h:111
NCX_PROTO_RESTCONF
@ NCX_PROTO_RESTCONF
IETF RESTCONF.
Definition: ncxtypes.h:788
agt_check_allowed_user
status_t agt_check_allowed_user(const xmlChar *username)
Check a username in the allowed-user Q.
Definition: agt.c:4632
agt_audit.h
NETCONF protocol audit log support.
agt_restconf_dispatch
boolean agt_restconf_dispatch(ses_cb_t *scb)
Dispatch an incoming RESTCONF request.
Definition: agt_restconf.c:2009
NCX_SERVER_VERSION
#define NCX_SERVER_VERSION
ncxserver version
Definition: ncxconst.h:183
agt_ses_max_cli_sessions
boolean agt_ses_max_cli_sessions(void)
Check if max-cli-sessions parameter has been reached.
Definition: agt_ses.c:2364
NCX_BT_UINT16
@ NCX_BT_UINT16
uint16
Definition: ncxtypes.h:212
agt_ses_request_close
boolean agt_ses_request_close(ses_cb_t *scb, ses_id_t killedby, ses_term_reason_t termreason)
Start the close of the specified session.
Definition: agt_ses.c:1056
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
get_error_string
const char * get_error_string(status_t res)
Get the error message for a specific internal error.
Definition: status.c:239
log_debug
void void void void void void void log_debug(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG log entry.
LOGINFO
#define LOGINFO
Check if at least log-level=info.
Definition: log.h:279
agt.h
Multi-Protocol Network Management Server.
SES_TRANSPORT_AFLOCAL
@ SES_TRANSPORT_AFLOCAL
ncxserver.sock AF_LOCAL socket – control msg
Definition: ses.h:342
NCX_PROTO_YCONTROL
@ NCX_PROTO_YCONTROL
YumaPro Internal Control 1.0.
Definition: ncxtypes.h:787
ERR_NCX_RESOURCE_DENIED
@ ERR_NCX_RESOURCE_DENIED
269
Definition: status_enum.h:310
ses_set_control_session
status_t ses_set_control_session(ses_cb_t *scb)
Set the specified session as a control session.
Definition: ses.c:4365
agt_callhome_connecting
boolean agt_callhome_connecting(const xmlChar *addr)
Check if the source address is connecting in a callhome session.
Definition: agt_callhome.c:723
agt_acm_session_is_superuser
boolean agt_acm_session_is_superuser(const ses_cb_t *scb)
Check if the specified session is the superuser.
Definition: agt_acm.c:868
NCX_SES_EVENT_START
@ NCX_SES_EVENT_START
session started event
Definition: ncxtypes.h:1411
NCX_SERVER_TRANSPORT_AFLOCAL
#define NCX_SERVER_TRANSPORT_AFLOCAL
ncxserver server transport for local system connections
Definition: ncxconst.h:177
agt_connect_cleanup
void agt_connect_cleanup(void)
Cleanup the agt_connect module.
Definition: agt_connect.c:214
agt_sys_send_sysSessionStart
void agt_sys_send_sysSessionStart(const ses_cb_t *scb)
Queue the Session Start notification.
Definition: agt_sys.c:1192
agt_yangapi_dispatch
boolean agt_yangapi_dispatch(ses_cb_t *scb)
Dispatch an incoming Yuma REST API request.
Definition: agt_yangapi.c:882
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
log.h
NCX System Logging Manager.
agt_sys.h
NETCONF system.yang DM module support.
agt_hello.h
Handle the NETCONF <hello> (top-level) element.
LOGDEBUG
#define LOGDEBUG
Check if at least log-level=debug.
Definition: log.h:287
xml_find_attr
xml_attr_t * xml_find_attr(xml_node_t *node, xmlns_id_t nsid, const xmlChar *attrname)
Find an attribute.
Definition: xml_util.c:1295
agt_state_add_session
status_t agt_state_add_session(ses_cb_t *scb)
Add a session entry to the netconf-state DM.
Definition: agt_state.c:2303
agt_connect.h
Handle the <ncx-connect> (top-level) element.
agt_waiting_datastore_ready
boolean agt_waiting_datastore_ready(void)
Check if client sessions are blocked until the datastore is ready.
Definition: agt.c:5441
SES_PEERADDR
#define SES_PEERADDR(S)
get the session peer address
Definition: ses.h:180
SES_STATE
#define SES_STATE(S)
get the session state
Definition: ses.h:177
NCX_BT_UINT32
@ NCX_BT_UINT32
uint32
Definition: ncxtypes.h:213
agt_acm.h
NETCONF Server Access Control Entry Points.
top_unregister_node
void top_unregister_node(const xmlChar *owner, const xmlChar *elname, top_mode_t topmode)
Remove a top entry handler function.
Definition: top.c:265
agt_get_profile
agt_profile_t * agt_get_profile(void)
Get the server profile struct.
Definition: agt.c:4118
top.h
NCX Common Top Element module.
agt_cb_run_session_hook
void agt_cb_run_session_hook(ncx_ses_event_t ses_event, const ses_cb_t *scb)
Run Session Hook callbacks.
Definition: agt_cb.c:4742
cap.h
NETCONF protocol capabilities.
ERR_NCX_ACCESS_DENIED
@ ERR_NCX_ACCESS_DENIED
267
Definition: status_enum.h:308
SES_ST_HELLO_WAIT
@ SES_ST_HELLO_WAIT
waiting for peer <hello>
Definition: ses.h:355
ncx.h
YANG module utility functions.
agt_rpcerr.h
NETCONF protocol <rpc-error> server-side handler.
ses_is_control_session
boolean ses_is_control_session(ses_cb_t *scb)
Check if the specified session is a control session.
Definition: ses.c:4386
SES_TRANSPORT
#define SES_TRANSPORT(S)
get the session transport enum
Definition: ses.h:183
agt_yp_ha.h
YumaPro High Availability module (YP-HA)
SES_PROTOCOL
#define SES_PROTOCOL(S)
get the session protocol enum
Definition: ses.h:186
agt_connect_dispatch
boolean agt_connect_dispatch(ses_cb_t *scb, xml_node_t *top)
Handle an incoming <ncx-connect> request.
Definition: agt_connect.c:248
SES_MY_SID
#define SES_MY_SID(S)
get session-id
Definition: ses.h:105
SES_MY_FD
#define SES_MY_FD(S)
get file descriptor
Definition: ses.h:108
agt_ycontrol.h
Handle the YumaPro Control Protocol <ycontrol> (top-level) element.
SES_TR_BAD_START
@ SES_TR_BAD_START
bad session start
Definition: ses.h:394
SES_TRANSPORT_HTTP
@ SES_TRANSPORT_HTTP
YumaPro REST API ncxconnect, no framing.
Definition: ses.h:339
ncx_convert_num
status_t ncx_convert_num(const xmlChar *numstr, ncx_numfmt_t numfmt, ncx_btype_t btyp, ncx_num_t *val)
Convert a number string to a numeric type.
Definition: ncx_num.c:717
agt_state_remove_session
void agt_state_remove_session(ses_cb_t *scb)
Remove a session entry from the netconf-state DM.
Definition: agt_state.c:2402
agt_init2_done
boolean agt_init2_done(void)
Check if the init2 phase is complete.
Definition: agt.c:4983
agt_maintenance_mode_session_ok
boolean agt_maintenance_mode_session_ok(void)
Return true if in maintenance mode new sessions OK;.
Definition: agt.c:5227
XML_NT_EMPTY
@ XML_NT_EMPTY
standalone empty node
Definition: xml_util.h:191
SES_ST_INIT
@ SES_ST_INIT
initialization state
Definition: ses.h:354
TOP_MODE_SERVER
@ TOP_MODE_SERVER
top server mode
Definition: top.h:119
top_register_node
status_t top_register_node(const xmlChar *owner, const xmlChar *elname, top_handler_t handler, top_mode_t topmode)
Register a top entry handler function.
Definition: top.c:202
status.h
Global error messages for status code enumerations.
subsys_magic.h
Define magic string value for <ncx-connect> messages.
yangapi.h
YANG-API definitions (pre-RESTCONF)
agt_callhome.h
IETF CallHome reverse connection support.
SES_ST_IN_MSG
@ SES_ST_IN_MSG
processing a request
Definition: ses.h:359
LOGDEBUG3
#define LOGDEBUG3
Check if at least log-level=debug3.
Definition: log.h:297
NCX_SERVER_TRANSPORT
#define NCX_SERVER_TRANSPORT
yumaserver server transport for SSH sessions
Definition: ncxconst.h:162
ERR_NCX_NO_ACCESS_STATE
@ ERR_NCX_NO_ACCESS_STATE
302
Definition: status_enum.h:345