![]() |
yumapro
25.10-1
YumaPro SDK
|
General utlities to support the server implementation. More...

Functions | |
| xmlChar * | ncx_get_source_ex (const xmlChar *fspec, boolean expand_cwd, status_t *res) |
| Expand a filespec into an absolute path. More... | |
| xmlChar * | ncx_get_source (const xmlChar *fspec, status_t *res) |
| Expand a filespec into an absolute path. More... | |
| boolean | ncx_prefix_different (const xmlChar *prefix1, const xmlChar *prefix2, const xmlChar *modprefix) |
| Check if the specified prefix pair reference different modules. More... | |
| status_t | ncx_get_version (xmlChar *buffer, uint32 buffsize) |
| Get the the Yuma version ID string. More... | |
| status_t | ncx_get_semver (xmlChar *buffer, uint32 buffsize) |
| Get the the Yuma SEMVER version ID string. More... | |
| status_t | ncx_get_full_version (xmlChar *buffer, uint32 buffsize) |
| Get the the Yuma version ID string and SEMVER added. More... | |
| const char * | ncx_get_build_date (void) |
| Get the build date string encoded into this C file. More... | |
| status_t | ncx_get_feature_code (xmlChar *buffer, uint32 buffsize) |
| Get the the Feature Code String. More... | |
| int32 | ncx_compare_base_uris (const xmlChar *str1, const xmlChar *str2) |
| Compare the base part of 2 URI strings. More... | |
| boolean | ncx_val_protocol_enabled (ncx_protocol_t proto, uint16 flags) |
| Check if the specified protocol version is enabled. More... | |
| void | ncx_set_val_protocol_enabled (ncx_protocol_t proto, uint16 *flags) |
| Set the specified protocol version to be enabled in a uint16 bits val. More... | |
| void | ncx_set_val_protocol_disabled (ncx_protocol_t proto, uint16 *flags) |
| Set the specified protocol version to be disabled in a uint16 bits val. More... | |
| boolean | ncx_protocol_is_netconf (ncx_protocol_t proto) |
| Check if the protocol is a NETCONF protocol. More... | |
| void | ncx_write_tracefile (const char *buff, uint32 count) |
| Write a byte to the tracefile. More... | |
| status_t | ncx_decode_url_string (const xmlChar *urlstr, uint32 urlstrlen, xmlChar *buffer, uint32 *cnt) |
| Fill buffer with a plain string from a URL string. More... | |
| status_t | ncx_create_pidfile (const xmlChar *progname, boolean fileloc_fhs) |
| Create the pidfile for the specified program. More... | |
| status_t | ncx_add_ydtrace (const xmlChar *fspec) |
| Add the filespec of a yangdump file being processed. More... | |
| boolean | ncx_find_ydtrace (const xmlChar *fspec) |
| Find the filespec of a yangdump file being processed. More... | |
| ncx_result_format_t | ncx_get_file_result_format (const xmlChar *filespec) |
| Check the filespec string for a file assignment statement to see if it is text, XML, or JSON. More... | |
| boolean | ncx_library_mode_ok (const xmlChar *modname, const xmlChar *rpcname) |
| Check if RPC OK to use in library mode. More... | |
| const char * | ncx_get_progname (void) |
| Get the progname buffer. More... | |
| boolean | ncx_ok_for_inline_data (obj_template_t *obj) |
| Check if the object is OK for inline data. More... | |
| boolean | ncx_check_inline_data_state (const xmlChar *line, boolean curstate) |
| Check the input line for Start or End of data tags. More... | |
| void | ncx_set_use_return_status (void) |
| Enable the return_status parameter. More... | |
| boolean | ncx_use_return_status (void) |
| Check if the return_status should be returned. More... | |
| ncx_bad_reply_enum | ncx_get_handle_badreply_enum (const xmlChar *valstr) |
| Check if the specified string matches an ncx_bad_reply_enum enum. More... | |
| const xmlChar * | ncx_get_handle_badreply_string (ncx_bad_reply_enum badreply) |
| Get the string for the specified enum value. More... | |
| void | ncx_set_handle_badreply (ncx_bad_reply_enum enumval) |
| Set the enum value for the Bad Reply handling option. More... | |
| ncx_bad_reply_enum | ncx_get_handle_badreply (void) |
| Get the enum for the Bad Reply Handling option. More... | |
| boolean | ncx_conf_env_vars_enabled (void) |
| Get the Config Environment Variable Replacement flag. More... | |
| ncx_etag_t | ncx_txid2etag (ncx_transaction_id_t txid) |
| Cast ncx_txid_t to ncx_etag_t. More... | |
| const xmlChar * | ncx_get_xpath_type_str (ncx_xpath_type_t xpath_typ) |
| Get the string for the ncx_xpath_type_t enum. More... | |
| uint16 | ncx_get_curQ_mod_count (void) |
| Get the total count of the currently fully loaded modules in the ncx_curQ. More... | |
| dlq_hdr_t * | ncx_get_rootQ (void) |
| Get the Root control block queue. More... | |
| ncx_sm_rootcb_t * | ncx_first_rootcb (void) |
| Get the first Mount Point Control Block Entry in the rootcbQ. More... | |
| ncx_sm_rootcb_t * | ncx_next_rootcb (ncx_sm_rootcb_t *rootcb) |
| Get the next Mount Point Entry in the rootcbQ. More... | |
| boolean | ncx_is_sm_mode (void) |
| Check if the Schema Mount mode is enabled. More... | |
| void | ncx_set_sm_mode (boolean val) |
| Set the Schema Mount mode. More... | |
| ncx_sm_rootcb_t * | ncx_get_cur_rootcb (void) |
| Gte the current root control block value. More... | |
| void | ncx_set_cur_rootcb (ncx_sm_rootcb_t *rootcb) |
| Set the current root control block. More... | |
| obj_template_t * | ncx_get_cur_rootcb_obj (void) |
| Get the current root control block object. More... | |
| boolean | ncx_get_sm_enabled (void) |
| Get schema mount enabled flag. More... | |
| void | ncx_set_sm_enabled (boolean val) |
| Set schema mount enabled flag. More... | |
| boolean | ncx_yang_cbor_enabled (void) |
| Get the YANG to CBOR Code enabled flag. More... | |
| unsigned short | ncx_get_tcp_connect_timeout (void) |
| Get the configured TCP connect timeout value. More... | |
| void | ncx_set_tcp_connect_timeout (unsigned short timeout_sec) |
| Set the configured TCP connect timeout value. More... | |
| ncx_module_t * | ncx_find_module_que_all (dlq_hdr_t *modQ, const xmlChar *modname, const xmlChar *revision) |
| Find a ncx_module_t in the specified Q and check the namespace ID check submodules, not just modules. More... | |
| void | ncx_redo_loadmod_all (void) |
| Set the redo_loadmod flag for all modules. More... | |
| void | ncx_set_disable_imported (void) |
| Allow the obj_is_enabled funtion to disable all import-only modules. More... | |
| boolean | ncx_disable_imported_ok (void) |
| Check if disable all import-only modules OK. More... | |
| void | ncx_set_save_error_input (void) |
| Allow the audit-log reporting to show the bad input instead of discarding nodes with invalid-value errors. More... | |
| boolean | ncx_save_error_input (void) |
| Check if the error input should be saved instead of discarding nodes with invalid-value errors. More... | |
| void | ncx_set_mod_augmented (ncx_module_t *mod) |
| Set the module as supported because it is being augmented. More... | |
| boolean | ncx_mod_parse_done (const ncx_module_t *mod) |
| Check if the module is completely parsed yet. More... | |
| status_t | ncx_set_chunk_size (uint16 chunksize) |
| Set the default chunk size for session buffers. More... | |
| uint16 | ncx_get_chunk_size (void) |
| Get the default chunk size for session buffers. More... | |
| const xmlChar * | ncx_get_real_notif_modname (const xmlChar *modname, const xmlChar *name) |
| check fake notification object and get RESTCONF modname if found. More... | |
| const xmlChar * | ncx_get_fake_notif_modname (const xmlChar *modname, const xmlChar *name) |
| check RESTCONF modname and convert to fake module name Used by JSON decoder. More... | |
| void | ncx_set_mod_stable (boolean state) |
| Set the yangcli flag to indicate the module set loading modules from the server capabilities is in progress. More... | |
| boolean | ncx_get_mod_stable (void) |
| Get the yangcli flag to indicate the module set loading modules from the server capabilities is in progress. More... | |
| status_t | send_buff (int fd, const char *buffer, size_t cnt) |
| Send the buffer to the network peer. More... | |
General utlities to support the server implementation.
Convert the filespec to an absolute path.
| status_t ncx_add_ydtrace | ( | const xmlChar * | fspec | ) |
Add the filespec of a yangdump file being processed.
| fspec | filespec to save |


| boolean ncx_check_inline_data_state | ( | const xmlChar * | line, |
| boolean | curstate | ||
| ) |
Check the input line for Start or End of data tags.
| line | line buffer to check |
| curstate | FALSE if not inline; TRUE if in inline |

| int32 ncx_compare_base_uris | ( | const xmlChar * | str1, |
| const xmlChar * | str2 | ||
| ) |
Compare the base part of 2 URI strings.
| str1 | URI string 1 |
| str2 | URI string 2 |

| boolean ncx_conf_env_vars_enabled | ( | void | ) |
Get the Config Environment Variable Replacement flag.
Placeholder: no configuration option to turn this off
| status_t ncx_create_pidfile | ( | const xmlChar * | progname, |
| boolean | fileloc_fhs | ||
| ) |
Create the pidfile for the specified program.
Check if the file already exists. If so, then print an error message and return an error
| progname | program name |
| fileloc_fhs | TRUE if FHS locations; FALSE if yumadir location |

| status_t ncx_decode_url_string | ( | const xmlChar * | urlstr, |
| uint32 | urlstrlen, | ||
| xmlChar * | buffer, | ||
| uint32 * | cnt | ||
| ) |
Fill buffer with a plain string from a URL string.
| urlstr | string to convert | |
| urlstrlen | number of bytes to check | |
| buffer | buffer to fill; may be NULL to get count | |
| [out] | cnt | address of return cnt
|


| boolean ncx_disable_imported_ok | ( | void | ) |
Check if disable all import-only modules OK.

| ncx_module_t * ncx_find_module_que_all | ( | dlq_hdr_t * | modQ, |
| const xmlChar * | modname, | ||
| const xmlChar * | revision | ||
| ) |
Find a ncx_module_t in the specified Q and check the namespace ID check submodules, not just modules.
| modQ | module Q to search |
| modname | module name |
| revision | module revision date |


| boolean ncx_find_ydtrace | ( | const xmlChar * | fspec | ) |
Find the filespec of a yangdump file being processed.
| fspec | filespec to find |


| ncx_sm_rootcb_t * ncx_first_rootcb | ( | void | ) |
Get the first Mount Point Control Block Entry in the rootcbQ.

| const char * ncx_get_build_date | ( | void | ) |
Get the build date string encoded into this C file.
YPW-1908: add get-server-version RPC to yumaworks-system
| uint16 ncx_get_chunk_size | ( | void | ) |
Get the default chunk size for session buffers.

| ncx_sm_rootcb_t * ncx_get_cur_rootcb | ( | void | ) |
Gte the current root control block value.
Get the current root control block value

| obj_template_t * ncx_get_cur_rootcb_obj | ( | void | ) |
Get the current root control block object.
Get the current root control block object
| uint16 ncx_get_curQ_mod_count | ( | void | ) |
Get the total count of the currently fully loaded modules in the ncx_curQ.


| const xmlChar * ncx_get_fake_notif_modname | ( | const xmlChar * | modname, |
| const xmlChar * | name | ||
| ) |
check RESTCONF modname and convert to fake module name Used by JSON decoder.
HACK: The JSON module-name ietf-restconf is not a real module Need to check for this condition
| modname | modname or NULL |
| name | == node name |

| status_t ncx_get_feature_code | ( | xmlChar * | buffer, |
| uint32 | buffsize | ||
| ) |
Get the the Feature Code String.
| buffer | buffer to hold the feature code string |
| buffsize | number of bytes in buffer |

| ncx_result_format_t ncx_get_file_result_format | ( | const xmlChar * | filespec | ) |
Check the filespec string for a file assignment statement to see if it is text, XML, or JSON.
| filespec | string to check |

| status_t ncx_get_full_version | ( | xmlChar * | buffer, |
| uint32 | buffsize | ||
| ) |
Get the the Yuma version ID string and SEMVER added.
buffer should use NCX_FULL_VERSION_BUFFSIZE constant
| buffer | buffer to hold the version string |
| buffsize | number of bytes in buffer |


| ncx_bad_reply_enum ncx_get_handle_badreply | ( | void | ) |
Get the enum for the Bad Reply Handling option.
| ncx_bad_reply_enum ncx_get_handle_badreply_enum | ( | const xmlChar * | valstr | ) |
Check if the specified string matches an ncx_bad_reply_enum enum.
| valstr | to use for convertion |

| const xmlChar * ncx_get_handle_badreply_string | ( | ncx_bad_reply_enum | badreply | ) |
Get the string for the specified enum value.
| badreply | enum value to check |
| boolean ncx_get_mod_stable | ( | void | ) |
Get the yangcli flag to indicate the module set loading modules from the server capabilities is in progress.

| const char * ncx_get_progname | ( | void | ) |
Get the progname buffer.

| const xmlChar * ncx_get_real_notif_modname | ( | const xmlChar * | modname, |
| const xmlChar * | name | ||
| ) |
check fake notification object and get RESTCONF modname if found.
Used by JSON Encoder.
HACK: The JSON module-name ietf-restconf is not a real module Need to check for this condition
| modname | modname or NULL |
| name | == node name |


| dlq_hdr_t * ncx_get_rootQ | ( | void | ) |
Get the Root control block queue.

| status_t ncx_get_semver | ( | xmlChar * | buffer, |
| uint32 | buffsize | ||
| ) |
Get the the Yuma SEMVER version ID string.
buffer should use NCX_SEMVER_BUFFSIZE constant
| buffer | buffer to hold the version string |
| buffsize | number of bytes in buffer |
| boolean ncx_get_sm_enabled | ( | void | ) |
Get schema mount enabled flag.
On the server this flag will be set to false if there is no sm-config provided. This will save time and memory by ignoring mount-points that have no chance of being used.

| xmlChar * ncx_get_source | ( | const xmlChar * | fspec, |
| status_t * | res | ||
| ) |
Expand a filespec into an absolute path.
Get a malloced buffer containing the complete filespec for the given input string. If this is a complete dirspec, this this will just strdup the value.
This is just a best effort to get the full spec. If the full spec is greater than 1500 bytes, then a NULL value (error) will be returned
This will expand the cwd!
| fspec | input filespec | |
| [out] | res | address of return status
|


| xmlChar * ncx_get_source_ex | ( | const xmlChar * | fspec, |
| boolean | expand_cwd, | ||
| status_t * | res | ||
| ) |
Expand a filespec into an absolute path.
Get a malloced buffer containing the complete filespec for the given input string. If this is a complete dirspec, this this will just strdup the value.
This is just a best effort to get the full spec. If the full spec is greater than 1500 bytes, then a NULL value (error) will be returned
| fspec | input filespec | |
| expand_cwd | TRUE if foo should be expanded to /cur/dir/foo; FALSE if not | |
| [out] | res | address of return status
|


| unsigned short ncx_get_tcp_connect_timeout | ( | void | ) |
Get the configured TCP connect timeout value.
| status_t ncx_get_version | ( | xmlChar * | buffer, |
| uint32 | buffsize | ||
| ) |
Get the the Yuma version ID string.
buffer should use NCX_VERSION_BUFFSIZE constant
| buffer | buffer to hold the version string |
| buffsize | number of bytes in buffer |


| const xmlChar * ncx_get_xpath_type_str | ( | ncx_xpath_type_t | xpath_typ | ) |
Get the string for the ncx_xpath_type_t enum.
| xpath_typ | xpath_typ enum to convert to str |

| boolean ncx_is_sm_mode | ( | void | ) |
Check if the Schema Mount mode is enabled.
FIXME: WHAT IS sm_mode and where is it documented???
Check if the Schema Mount mode have been set yet

| boolean ncx_library_mode_ok | ( | const xmlChar * | modname, |
| const xmlChar * | rpcname | ||
| ) |
Check if RPC OK to use in library mode.
Hardwired list of RPCs OK for library mode Only used by the server if –library-mode=true
HACK: this should be in the server, not libncx
| modname | module name containing the RPC method |
| rpcname | RPC name to check |


| boolean ncx_mod_parse_done | ( | const ncx_module_t * | mod | ) |
Check if the module is completely parsed yet.
| mod | module to check |

| ncx_sm_rootcb_t * ncx_next_rootcb | ( | ncx_sm_rootcb_t * | rootcb | ) |
Get the next Mount Point Entry in the rootcbQ.
| rootcb | current Mount Point Entry |

| boolean ncx_ok_for_inline_data | ( | obj_template_t * | obj | ) |
Check if the object is OK for inline data.
| obj | object to check |

| boolean ncx_prefix_different | ( | const xmlChar * | prefix1, |
| const xmlChar * | prefix2, | ||
| const xmlChar * | modprefix | ||
| ) |
Check if the specified prefix pair reference different modules.
| prefix1 | 1st prefix to check (may be NULL) |
| prefix2 | 2nd prefix to check (may be NULL) |
| modprefix | module prefix to check (may be NULL) |


| boolean ncx_protocol_is_netconf | ( | ncx_protocol_t | proto | ) |
Check if the protocol is a NETCONF protocol.
| proto | protocol version to check |
| void ncx_redo_loadmod_all | ( | void | ) |
Set the redo_loadmod flag for all modules.
If the same module is used in multiple bundles then there will only be a load-module callback once. This flag will get set to FALSE when the load-module callback is attempted
| boolean ncx_save_error_input | ( | void | ) |
Check if the error input should be saved instead of discarding nodes with invalid-value errors.
| status_t ncx_set_chunk_size | ( | uint16 | chunksize | ) |
Set the default chunk size for session buffers.
| chunksize | (range 1000 to 9000) |
| void ncx_set_cur_rootcb | ( | ncx_sm_rootcb_t * | rootcb | ) |
Set the current root control block.
Set the current root control block value
| rootcb | Root control block to set as current |

| void ncx_set_disable_imported | ( | void | ) |
Allow the obj_is_enabled funtion to disable all import-only modules.
Relevant to netconfd-pro only at this time!

| void ncx_set_handle_badreply | ( | ncx_bad_reply_enum | enumval | ) |
Set the enum value for the Bad Reply handling option.
| enumval | enum value to use |
| void ncx_set_mod_augmented | ( | ncx_module_t * | mod | ) |
Set the module as supported because it is being augmented.
| mod | module to check |

| void ncx_set_mod_stable | ( | boolean | state | ) |
Set the yangcli flag to indicate the module set loading modules from the server capabilities is in progress.
This will prevent obj_is_enabled from setting the object flags too early for some if-feature cornercases where the module with the features has not been processed yet but an augmented object with that if-feature-stmt is being processed.
If never called then 'true' is returned
| state | TRUE if mod stable; FALSE if not |
| void ncx_set_save_error_input | ( | void | ) |
Allow the audit-log reporting to show the bad input instead of discarding nodes with invalid-value errors.
| void ncx_set_sm_enabled | ( | boolean | val | ) |
Set schema mount enabled flag.
| val | TRUE ifr schema mount is enabled |
| void ncx_set_sm_mode | ( | boolean | val | ) |
Set the Schema Mount mode.
Set the sm_mode value
FIXME: WHAT IS sm_mode and where is it documented???
| val | TRUE if schema mount mode should be used FALSE if schema mount mode should not ne used |

| void ncx_set_tcp_connect_timeout | ( | unsigned short | timeout_sec | ) |
Set the configured TCP connect timeout value.
| timeout_sec | timeout value in seconds; 0 == use blocking mode |

| void ncx_set_use_return_status | ( | void | ) |
Enable the return_status parameter.
| void ncx_set_val_protocol_disabled | ( | ncx_protocol_t | proto, |
| uint16 * | flags | ||
| ) |
Set the specified protocol version to be disabled in a uint16 bits val.
| proto | protocol version to enable | |
| [out] | flags | address of bitmask to set *flags is set with the bit for the protocol |
| void ncx_set_val_protocol_enabled | ( | ncx_protocol_t | proto, |
| uint16 * | flags | ||
| ) |
Set the specified protocol version to be enabled in a uint16 bits val.
| proto | protocol version to enable | |
| [out] | flags | address of bitmask to set *flags is set with the bit for the protocol |
| ncx_etag_t ncx_txid2etag | ( | ncx_transaction_id_t | txid | ) |
Cast ncx_txid_t to ncx_etag_t.
This is a utility function to convert uint64 txid to uint32 etag so that it is more alignment-safe when cast
| txid | uint64 ncx_transaction_id_t object |

| boolean ncx_use_return_status | ( | void | ) |
Check if the return_status should be returned.
| boolean ncx_val_protocol_enabled | ( | ncx_protocol_t | proto, |
| uint16 | flags | ||
| ) |
Check if the specified protocol version is enabled.
| proto | protocol enum to check |
| flags | bitmask to check if proto is set |
| void ncx_write_tracefile | ( | const char * | buff, |
| uint32 | count | ||
| ) |
Write a byte to the tracefile.
Internal function only
| buff | buffer to write |
| count | number of chars to write |

| boolean ncx_yang_cbor_enabled | ( | void | ) |
Get the YANG to CBOR Code enabled flag.

| status_t send_buff | ( | int | fd, |
| const char * | buffer, | ||
| size_t | cnt | ||
| ) |
Send the buffer to the network peer.
This function is used by applications which do not select for write_fds, and may not block (if fnctl used)
| fd | the socket to write to |
| buffer | the buffer to write |
| cnt | the number of bytes to write |
