/usr/include/yuma/ncx/xpath_yang.h is in libyuma-dev 2.10-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | /*
* Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef _H_xpath_yang
#define _H_xpath_yang
/* FILE: xpath_yang.h
*********************************************************************
* *
* P U R P O S E *
* *
*********************************************************************
YANG-specific Xpath support
*********************************************************************
* *
* C H A N G E H I S T O R Y *
* *
*********************************************************************
date init comment
----------------------------------------------------------------------
13-nov-08 abb Begun
*/
#include <xmlstring.h>
#include <xmlreader.h>
#include <xmlregexp.h>
#ifndef _H_dlq
#include "dlq.h"
#endif
#ifndef _H_ncxtypes
#include "ncxtypes.h"
#endif
#ifndef _H_status
#include "status.h"
#endif
#ifndef _H_obj
#include "obj.h"
#endif
#ifndef _H_tk
#include "tk.h"
#endif
#ifndef _H_val
#include "val.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/********************************************************************
* *
* F U N C T I O N S *
* *
*********************************************************************/
/********************************************************************
* FUNCTION xpath_yang_parse_path
*
* Parse the leafref path as a leafref path
*
* DOES NOT VALIDATE PATH NODES USED IN THIS PHASE
* A 2-pass validation is used in case the path expression
* is defined within a grouping. This pass is
* used on all objects, even in groupings
*
* Error messages are printed by this function!!
* Do not duplicate error messages upon error return
*
*
* INPUTS:
* tkc == parent token chain (may be NULL)
* mod == module in progress
* source == context for this expression
* XP_SRC_LEAFREF or XP_SRC_INSTANCEID
* pcb == initialized xpath parser control block
* for the leafref path; use xpath_new_pcb
* to initialize before calling this fn.
* The pcb->exprstr field must be set
*
* OUTPUTS:
* pcb->tkc is filled and then validated for well-formed
* leafref or instance-identifier syntax
*
* RETURNS:
* status
*********************************************************************/
extern status_t
xpath_yang_parse_path (tk_chain_t *tkc,
ncx_module_t *mod,
xpath_source_t source,
xpath_pcb_t *pcb);
/********************************************************************
* FUNCTION xpath_yang_parse_path_ex
*
* Parse the leafref path as a leafref path
*
* DOES NOT VALIDATE PATH NODES USED IN THIS PHASE
* A 2-pass validation is used in case the path expression
* is defined within a grouping. This pass is
* used on all objects, even in groupings
*
* Error messages are printed by this function!!
* Do not duplicate error messages upon error return
*
*
* INPUTS:
* tkc == parent token chain (may be NULL)
* mod == module in progress
* obj == context node
* source == context for this expression
* XP_SRC_LEAFREF or XP_SRC_INSTANCEID
* pcb == initialized xpath parser control block
* for the leafref path; use xpath_new_pcb
* to initialize before calling this fn.
* The pcb->exprstr field must be set
* logerrors == TRUE to log errors;
* == FALSE to suppress error messages
* OUTPUTS:
* pcb->tkc is filled and then validated for well-formed
* leafref or instance-identifier syntax
*
* RETURNS:
* status
*********************************************************************/
extern status_t
xpath_yang_parse_path_ex (tk_chain_t *tkc,
ncx_module_t *mod,
xpath_source_t source,
xpath_pcb_t *pcb,
boolean logerrors);
/********************************************************************
* FUNCTION xpath_yang_validate_path
*
* Validate the previously parsed leafref path
* - QNames are valid
* - object structure referenced is valid
* - objects are all 'config true'
* - target object is a leaf
* - leafref represents a single instance
*
* A 2-pass validation is used in case the path expression
* is defined within a grouping. This pass is
* used only on cooked (real) objects
*
* Called after all 'uses' and 'augment' expansion
* so validation against cooked object tree can be done
*
* Error messages are printed by this function!!
* Do not duplicate error messages upon error return
*
* INPUTS:
* mod == module containing the 'obj' (in progress)
* == NULL if no object in progress
* obj == object using the leafref data type
* pcb == the leafref parser control block, possibly
* cloned from from the typdef
* schemainst == TRUE if ncx:schema-instance string
* == FALSE to use the pcb->source field
* to determine the exact parse mode
* leafobj == address of the return target object
*
* OUTPUTS:
* *leafobj == the target leaf found by parsing the path (NO_ERR)
*
* RETURNS:
* status
*********************************************************************/
extern status_t
xpath_yang_validate_path (ncx_module_t *mod,
obj_template_t *obj,
xpath_pcb_t *pcb,
boolean schemainst,
obj_template_t **leafobj);
/********************************************************************
* FUNCTION xpath_yang_validate_path_ex
*
* Validate the previously parsed leafref path
* - QNames are valid
* - object structure referenced is valid
* - objects are all 'config true'
* - target object is a leaf
* - leafref represents a single instance
*
* A 2-pass validation is used in case the path expression
* is defined within a grouping. This pass is
* used only on cooked (real) objects
*
* Called after all 'uses' and 'augment' expansion
* so validation against cooked object tree can be done
*
* Error messages are printed by this function!!
* Do not duplicate error messages upon error return
*
* INPUTS:
* mod == module containing the 'obj' (in progress)
* == NULL if no object in progress
* obj == object using the leafref data type
* pcb == the leafref parser control block, possibly
* cloned from from the typdef
* schemainst == TRUE if ncx:schema-instance string
* == FALSE to use the pcb->source field
* to determine the exact parse mode
* leafobj == address of the return target object
* logerrors == TRUE to log errors, FALSE to suppress errors
* val_parse uses FALSE if basetype == NCX_BT_UNION
*
* OUTPUTS:
* *leafobj == the target leaf found by parsing the path (NO_ERR)
*
* RETURNS:
* status
*********************************************************************/
extern status_t
xpath_yang_validate_path_ex (ncx_module_t *mod,
obj_template_t *obj,
xpath_pcb_t *pcb,
boolean schemainst,
obj_template_t **leafobj,
boolean logerrors);
/********************************************************************
* FUNCTION xpath_yang_validate_xmlpath
*
* Validate an instance-identifier expression
* within an XML PDU context
*
* INPUTS:
* reader == XML reader to use
* pcb == initialized XPath parser control block
* with a possibly unchecked pcb->exprstr.
* This function will call tk_tokenize_xpath_string
* if it has not already been called.
* logerrors == TRUE if log_error and ncx_print_errormsg
* should be used to log XPath errors and warnings
* FALSE if internal error info should be recorded
* in the xpath_result_t struct instead
* !!! use FALSE unless DEBUG mode !!!
* targobj == address of return target object
*
* OUTPUTS:
* *targobj is set to the object that this instance-identifier
* references, if NO_ERR
* RETURNS:
* status
*********************************************************************/
extern status_t
xpath_yang_validate_xmlpath (xmlTextReaderPtr reader,
xpath_pcb_t *pcb,
obj_template_t *pathobj,
boolean logerrors,
obj_template_t **targobj);
/********************************************************************
* FUNCTION xpath_yang_validate_xmlkey
*
* Validate a key XML attribute value given in
* an <edit-config> operation with an 'insert' attribute
* Check that a complete set of predicates is present
* for the specified list of leaf-list
*
* INPUTS:
* reader == XML reader to use
* pcb == initialized XPath parser control block
* with a possibly unchecked pcb->exprstr.
* This function will call tk_tokenize_xpath_string
* if it has not already been called.
* obj == list or leaf-list object associated with
* the pcb->exprstr predicate expression
* (MAY be NULL if first-pass parsing and
* object is not known yet -- parsed in XML attribute)
* logerrors == TRUE if log_error and ncx_print_errormsg
* should be used to log XPath errors and warnings
* FALSE if internal error info should be recorded
* in the xpath_result_t struct instead
* !!! use FALSE unless DEBUG mode !!!
*
* RETURNS:
* status
*********************************************************************/
extern status_t
xpath_yang_validate_xmlkey (xmlTextReaderPtr reader,
xpath_pcb_t *pcb,
obj_template_t *obj,
boolean logerrors);
/********************************************************************
* FUNCTION xpath_yang_make_instanceid_val
*
* Make a value subtree out of an instance-identifier
* Used by yangcli to send PDUs from CLI target parameters
*
* The XPath pcb must be previously parsed and found valid
* It must be an instance-identifier value,
* not a leafref path
*
* INPUTS:
* pcb == the leafref parser control block, possibly
* cloned from from the typdef
* retres == address of return status (may be NULL)
* deepest == address of return deepest node created (may be NULL)
*
* OUTPUTS:
* if (non-NULL)
* *retres == return status
* *deepest == pointer to end of instance-id chain node
* RETURNS:
* malloced value subtree representing the instance-identifier
* in internal val_value_t data structures
*********************************************************************/
extern val_value_t *
xpath_yang_make_instanceid_val (xpath_pcb_t *pcb,
status_t *retres,
val_value_t **deepest);
/********************************************************************
* FUNCTION xpath_yang_get_namespaces
*
* Get the namespace URI IDs used in the specified
* XPath expression;
*
* usually an instance-identifier or schema-instance node
* but this function simply reports all the TK_TT_MSTRING
* tokens that have an nsid set
*
* The XPath pcb must be previously parsed and found valid
*
* INPUTS:
* pcb == the XPath parser control block to use
* nsid_array == address of return array of xmlns_id_t
* max_nsids == number of NSIDs that can be held
* num_nsids == address of return number of NSIDs
* written to the buffer. No duplicates
* will be present in the buffer
*
* OUTPUTS:
* nsid_array[0..*num_nsids] == returned NSIDs used
* in the XPath expression
* *num_nsids == number of NSIDs written to the array
*
* RETURNS:
* status
*********************************************************************/
extern status_t
xpath_yang_get_namespaces (const xpath_pcb_t *pcb,
xmlns_id_t *nsid_array,
uint32 max_nsids,
uint32 *num_nsids);
#ifdef __cplusplus
} /* end extern 'C' */
#endif
#endif /* _H_xpath_yang */
|