yumapro  20.10-12
YumaPro SDK
agt_hello.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_hello
13 #define _H_agt_hello
14 
15 /* FILE: agt_hello.h
16 *********************************************************************
17 * *
18 * P U R P O S E *
19 * *
20 *********************************************************************/
21 
28 /*********************************************************************
29 * *
30 * C H A N G E H I S T O R Y *
31 * *
32 *********************************************************************
33 
34 date init comment
35 ----------------------------------------------------------------------
36 19-jan-07 abb Begun
37 
38 */
39 
40 #ifndef _H_ses
41 #include "ses.h"
42 #endif
43 
44 #ifndef _H_status
45 #include "status.h"
46 #endif
47 
48 #ifndef _H_xml_util
49 #include "xml_util.h"
50 #endif
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 /********************************************************************
57 * *
58 * F U N C T I O N S *
59 * *
60 *********************************************************************/
61 
83 extern status_t
84  agt_hello_init (void);
85 
86 
92 extern void
93  agt_hello_cleanup (void);
94 
95 
104 extern boolean
105  agt_hello_dispatch (ses_cb_t *scb,
106  xml_node_t *top);
107 
108 
116 extern status_t
117  agt_hello_send (ses_cb_t *scb);
118 
119 
126 extern void
127  agt_hello_start_hello_timer (ses_cb_t *scb);
128 
129 
133 #ifdef __cplusplus
134 } /* end extern 'C' */
135 #endif
136 
137 #endif /* _H_agt_hello */
ses.h
NETCONF Session Common definitions module.
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
ses_set_protocol
status_t ses_set_protocol(ses_cb_t *scb, ncx_protocol_t proto)
set the NETCONF protocol version in use
Definition: ses.c:3780
agt_cap.h
NETCONF Server capabilities handler.
ses_finish_msg
void ses_finish_msg(ses_cb_t *scb)
Finish an outbound message on the specified session.
Definition: ses.c:3013
xml_msg_clean_hdr
void xml_msg_clean_hdr(xml_msg_hdr_t *msg)
Clean all the memory used by the specified xml_msg_hdr_t but do not free the struct itself.
Definition: xml_msg.c:438
agt_hello_cleanup
void agt_hello_cleanup(void)
Cleanup the agt_hello module.
Definition: agt_hello.c:179
agt_ses.h
Server Session Management.
agt_util.h
Utility Functions for NCX Server method routines.
val_find_child_fast
val_value_t * val_find_child_fast(const val_value_t *parent, xmlns_id_t nsid, const xmlChar *childname)
Find the first instance of the specified child node.
Definition: val.c:8588
ses_start_msg_mode
void ses_start_msg_mode(ses_cb_t *scb)
Set the message output mode to active.
Definition: ses.c:2932
ERR_NCX_DEF_NOT_FOUND
@ ERR_NCX_DEF_NOT_FOUND
250
Definition: status_enum.h:289
SES_ST_IDLE
@ SES_ST_IDLE
adble to accept requests
Definition: ses.h:358
val.h
Value Node Basic Support.
xml_util.h
XML Utilities.
NCX_PROTO_NETCONF11
@ NCX_PROTO_NETCONF11
RFC 6241 base:1.1.
Definition: ncxtypes.h:784
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.
xml_wr.h
XML Write functions.
op.h
NETCONF protocol operations.
xml_wr_begin_elem
void xml_wr_begin_elem(ses_cb_t *scb, xml_msg_hdr_t *msg, xmlns_id_t parent_nsid, xmlns_id_t nsid, const xmlChar *elname, int32 indent)
Write a start XML tag to the specified session without attributes.
Definition: xml_wr.c:3040
xml_clean_attrs
void xml_clean_attrs(xml_attrs_t *attrs)
clean an xml_attrs_t variable
Definition: xml_util.c:1243
log_info
void void void void void log_info(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_INFO log entry.
xmlns_id_t
uint16 xmlns_id_t
integer handle for registered namespaces
Definition: xmlns.h:89
ERR_NCX_MISSING_PARM
@ ERR_NCX_MISSING_PARM
233
Definition: status_enum.h:272
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.
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
NC_MODULE
#define NC_MODULE
Internal NETCONF YANG module.
Definition: ncxconst.h:71
xml_init_attrs
void xml_init_attrs(xml_attrs_t *attrs)
initialize an xml_attrs_t variable
Definition: xml_util.c:745
ses_get_protocol
ncx_protocol_t ses_get_protocol(const ses_cb_t *scb)
Get the NETCONF protocol set (or unset) for this session.
Definition: ses.c:3854
ses_message_indent_count
int32 ses_message_indent_count(const ses_cb_t *scb)
Get the message indent count for this session.
Definition: ses.c:2822
ncx_find_object
obj_template_t * ncx_find_object(ncx_module_t *mod, const xmlChar *objname)
Find a top level module object.
Definition: ncx.c:4345
LOGDEBUG2
#define LOGDEBUG2
Check if at least log-level=debug2.
Definition: log.h:292
ses_get_total_stats
ses_total_stats_t * ses_get_total_stats(void)
Get a r/w pointer to the the session totals stats.
Definition: ses.c:3560
SES_TR_BAD_HELLO
@ SES_TR_BAD_HELLO
bad <hello> received
Definition: ses.h:395
agt_hello_dispatch
boolean agt_hello_dispatch(ses_cb_t *scb, xml_node_t *top)
Handle an incoming <hello> message from the client.
Definition: agt_hello.c:202
log_debug_append
void void void void void void void void log_debug_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_DEBUG log entry.
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
agt_hello_start_hello_timer
void agt_hello_start_hello_timer(ses_cb_t *scb)
Set the timestamp to start the hello-timeout for the specified session.
Definition: agt_hello.c:421
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
xml_wr_end_elem
void xml_wr_end_elem(ses_cb_t *scb, xml_msg_hdr_t *msg, xmlns_id_t nsid, const xmlChar *elname, int32 indent)
Write an end tag to the specified session.
Definition: xml_wr.c:3114
get_error_string
const char * get_error_string(status_t res)
Get the error message for a specific internal error.
Definition: status.c:239
ERR_INTERNAL_PTR
@ ERR_INTERNAL_PTR
002
Definition: status_enum.h:192
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.
ncx_protocol_enabled
boolean ncx_protocol_enabled(ncx_protocol_t proto)
Check if the specified protocol version is enabled.
Definition: ncx.c:10192
xml_wr_full_val
void xml_wr_full_val(ses_cb_t *scb, xml_msg_hdr_t *msg, val_value_t *val, int32 indent)
Generate entire val_value_t.
Definition: xml_wr.c:3650
xml_msg_build_prefix_map
status_t xml_msg_build_prefix_map(xml_msg_hdr_t *msg, xml_attrs_t *attrs, boolean addncid, boolean addncxid)
Build a queue of xmlns_pmap_t records for the current message.
Definition: xml_msg.c:839
LOGINFO
#define LOGINFO
Check if at least log-level=info.
Definition: log.h:279
agt_hello_init
status_t agt_hello_init(void)
Initialize the agt_hello module.
Definition: agt_hello.c:151
ses_stop_msg_mode
void ses_stop_msg_mode(ses_cb_t *scb)
Set the message output mode to inactive.
Definition: ses.c:2950
agt.h
Multi-Protocol Network Management Server.
agt_val_parse_nc
status_t agt_val_parse_nc(ses_cb_t *scb, xml_msg_hdr_t *msg, obj_template_t *obj, const xml_node_t *startnode, ncx_data_class_t parentdc, val_value_t *retval)
Parse NETCONF PDU sub-contents into value fields.
Definition: agt_val_parse.c:118
NCX_DC_STATE
@ NCX_DC_STATE
state or statistics
Definition: ncxtypes.h:193
xml_wr_begin_elem_ex
void xml_wr_begin_elem_ex(ses_cb_t *scb, xml_msg_hdr_t *msg, xmlns_id_t parent_nsid, xmlns_id_t nsid, const xmlChar *elname, const dlq_hdr_t *attrQ, boolean isattrq, int32 indent, boolean empty)
Write a start or empty XML tag to the specified session.
Definition: xml_wr.c:3001
NCX_MAX_NUMLEN
#define NCX_MAX_NUMLEN
max number len to use for static buffer allocation only
Definition: ncxconst.h:136
xml_msg_init_hdr
void xml_msg_init_hdr(xml_msg_hdr_t *msg)
Initialize a new xml_msg_hdr_t struct.
Definition: xml_msg.c:393
agt_val_parse.h
XML Parameter Value Parser Module.
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.
xmlns_nc_id
xmlns_id_t xmlns_nc_id(void)
Get the ID for the NETCONF namespace or 0 if it doesn't exist.
Definition: xmlns.c:880
agt_hello.h
Handle the NETCONF <hello> (top-level) element.
LOGDEBUG
#define LOGDEBUG
Check if at least log-level=debug.
Definition: log.h:287
val_find_next_child_fast
val_value_t * val_find_next_child_fast(const val_value_t *parent, const val_value_t *curchild)
Find the next instance of the specified child node.
Definition: val.c:8774
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
top.h
NCX Common Top Element module.
cap.h
NETCONF protocol capabilities.
agt_timer_get_timenow
void agt_timer_get_timenow(time_t *tnow)
Get the current time using the system or monotonic clock.
Definition: agt_timer.c:457
val_new_value
val_value_t * val_new_value(void)
Malloc and initialize the fields in a val_value_t.
Definition: val.c:2697
SES_ST_HELLO_WAIT
@ SES_ST_HELLO_WAIT
waiting for peer <hello>
Definition: ses.h:355
ncx.h
YANG module utility functions.
xml_attrs_t
dlq_hdr_t xml_attrs_t
queue of xml_attr_t
Definition: xml_util.h:151
obj.h
Data Object Support.
ses_start_msg
status_t ses_start_msg(ses_cb_t *scb)
Start a new outbound message on the specified session.
Definition: ses.c:2970
SES_MY_SID
#define SES_MY_SID(S)
get session-id
Definition: ses.h:105
agt_cap_get_capsval
val_value_t * agt_cap_get_capsval(void)
Get the NETCONF server capabilities in val_value_t format.
Definition: agt_cap.c:966
VAL_STR
#define VAL_STR(V)
Access the value as a string ONLY if typ_is_string() is true.
Definition: val.h:464
CAP_BASE_URN
#define CAP_BASE_URN
NETCONF Base Protocol Capability String (base:1.0)
Definition: cap.h:88
agt_timer.h
Handle timer services for the server.
ncx_find_module
ncx_module_t * ncx_find_module(const xmlChar *modname, const xmlChar *revision)
Find a ncx_module_t in the ncx_sesmodQ.
Definition: ncx.c:3227
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
ses_putstr
void ses_putstr(ses_cb_t *scb, const xmlChar *str)
Write a zero-terminated string to the session.
Definition: ses.c:2460
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
val_free_value
void val_free_value(val_value_t *val)
Scrub the memory in a val_value_t by freeing all the sub-fields and then freeing the entire struct it...
Definition: val.c:2842
NCX_PROTO_NETCONF10
@ NCX_PROTO_NETCONF10
RFC 4741 base:1.0
Definition: ncxtypes.h:783
status.h
Global error messages for status code enumerations.
xml_dump_node
void xml_dump_node(const xml_node_t *node, log_debug_t lvl)
Debug function to printf xml_node_t contents.
Definition: xml_util.c:661
CAP_BASE_URN11
#define CAP_BASE_URN11
NETCONF Base Protocol Capability String (base:1.1)
Definition: cap.h:92
LOGDEBUG3
#define LOGDEBUG3
Check if at least log-level=debug3.
Definition: log.h:297