yumapro  23.10T-9
YumaPro SDK
Loading...
Searching...
No Matches
rpc_err.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_rpc_err
13#define _H_rpc_err
14/* FILE: rpc_err.h
15*********************************************************************
16* *
17* P U R P O S E *
18* *
19*********************************************************************/
20
27/*********************************************************************
28* *
29* C H A N G E H I S T O R Y *
30* *
31*********************************************************************
32
33date init comment
34----------------------------------------------------------------------
3506-apr-05 abb Begun.
36*/
37
38#ifndef _H_dlq
39#include "dlq.h"
40#endif
41
42#ifndef _H_ncxtypes
43#include "ncxtypes.h"
44#endif
45
46#ifndef _H_rpc
47#include "rpc.h"
48#endif
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54/********************************************************************
55* *
56* C O N S T A N T S *
57* *
58*********************************************************************/
59
259#ifndef _H_dlq
260#include "dlq.h"
261#endif
262
263/********************************************************************
264* *
265* C O N S T A N T S *
266* *
267*********************************************************************/
268
269/*** YANG standard error-app-tag values ***/
270/* 13.1 */
271#define RPC_ERR_APPTAG_UNIQUE_FAILED (const xmlChar *)"data-not-unique"
272
273/* 13.2 */
274#define RPC_ERR_APPTAG_MAX_ELEMS (const xmlChar *)"too-many-elements"
275
276/* 13.3 */
277#define RPC_ERR_APPTAG_MIN_ELEMS (const xmlChar *)"too-few-elements"
278
279/* 13.4 */
280#define RPC_ERR_APPTAG_MUST (const xmlChar *)"must-violation"
281
282/* 13.5 */
283#define RPC_ERR_APPTAG_INSTANCE_REQ (const xmlChar *)"instance-required"
284
285/* 13.6 */
286#define RPC_ERR_APPTAG_CHOICE (const xmlChar *)"missing-choice"
287
288/* 13.7 */
289#define RPC_ERR_APPTAG_INSERT (const xmlChar *)"missing-instance"
290
291
292#define RPC_ERR_APPTAG_RANGE (const xmlChar *)"not-in-range"
293
294#define RPC_ERR_APPTAG_VALUE_SET (const xmlChar *)"not-in-value-set"
295
296#define RPC_ERR_APPTAG_PATTERN (const xmlChar *)"pattern-test-failed"
297
298#define RPC_ERR_APPTAG_DATA_REST \
299 (const xmlChar *)"data-restriction-violation"
300
301#define RPC_ERR_APPTAG_DATA_NOT_UNIQUE \
302 (const xmlChar *)"data-not-unique"
303
304/* ietf-netconf-state:get-schema */
305/* ietf-netconf-partial-lock:partial-lock */
306#define RPC_ERR_APPTAG_NO_MATCHES (const xmlChar *)"no-matches"
307
308/* ietf-netconf-partial-lock:partial-lock */
309#define RPC_ERR_APPTAG_NOT_NODESET (const xmlChar *)"not-a-node-set"
310
311/* ietf-netconf-partial-lock:partial-lock */
312#define RPC_ERR_APPTAG_LOCKED (const xmlChar *)"locked"
313
314/* ietf-netconf-partial-lock:partial-lock */
315#define RPC_ERR_APPTAG_COMMIT (const xmlChar *)\
316 "outstanding-confirmed-commit"
317
318
319/*** netconfcentral errror-app-tag values ***/
320#define RPC_ERR_APPTAG_GEN_WARNING (const xmlChar *)"general-warning"
321#define RPC_ERR_APPTAG_GEN_ERROR (const xmlChar *)"general-error"
322#define RPC_ERR_APPTAG_INT_ERROR (const xmlChar *)"internal-error"
323#define RPC_ERR_APPTAG_IO_ERROR (const xmlChar *)"io-error"
324#define RPC_ERR_APPTAG_MALLOC_ERROR (const xmlChar *)"malloc-error"
325#define RPC_ERR_APPTAG_LIMIT_REACHED (const xmlChar *)"limit-reached"
326#define RPC_ERR_APPTAG_LIBXML2_ERROR (const xmlChar *)"libxml2-error"
327#define RPC_ERR_APPTAG_SQL_ERROR (const xmlChar *)"sql-error"
328#define RPC_ERR_APPTAG_SSH_ERROR (const xmlChar *)"ssh-error"
329#define RPC_ERR_APPTAG_BEEP_ERROR (const xmlChar *)"beep-error"
330#define RPC_ERR_APPTAG_HTML_ERROR (const xmlChar *)"html-error"
331#define RPC_ERR_APPTAG_DATA_INCOMPLETE (const xmlChar *)"data-incomplete"
332#define RPC_ERR_APPTAG_DATA_INVALID (const xmlChar *)"data-invalid"
333#define RPC_ERR_APPTAG_DUPLICATE_ERROR (const xmlChar *)"duplicate-error"
334#define RPC_ERR_APPTAG_RESOURCE_IN_USE (const xmlChar *)"resource-in-use"
335#define RPC_ERR_APPTAG_NO_ACCESS (const xmlChar *)"no-access"
336#define RPC_ERR_APPTAG_RECOVER_FAILED (const xmlChar *)"recover-failed"
337#define RPC_ERR_APPTAG_NO_SUPPORT (const xmlChar *)"no-support"
338
339
340/*** ietf-subscribed-notifications ***/
341
342#define RPC_ERR_APPTAG_NOTIF_DSCP_UNAVAILABLE \
343 (const xmlChar *)"ietf-subscribed-notifications:dscp-unavailable"
344
345#define RPC_ERR_APPTAG_NOTIF_ENCODING_UNSUPPORTED \
346 (const xmlChar *)"ietf-subscribed-notifications:encoding-unsupported"
347
348#define RPC_ERR_APPTAG_NOTIF_FILTER_UNAVAILABLE \
349 (const xmlChar *)"ietf-subscribed-notifications:filter-unavailable"
350
351#define RPC_ERR_APPTAG_NOTIF_FILTER_UNSUPPORTED \
352 (const xmlChar *)"ietf-subscribed-notifications:filter-unsupported"
353
354#define RPC_ERR_APPTAG_NOTIF_INSUFFICIENT_RESOURCES \
355 (const xmlChar *)"ietf-subscribed-notifications:insufficient-resources"
356
357#define RPC_ERR_APPTAG_NOTIF_NO_SUCH_SUBSCRIPTION \
358 (const xmlChar *)"ietf-subscribed-notifications:no-such-subscription"
359
360#define RPC_ERR_APPTAG_NOTIF_REPLAY_UNSUPPORTED \
361 (const xmlChar *)"ietf-subscribed-notifications:replay-unsupported"
362
363#define RPC_ERR_APPTAG_NOTIF_STREAM_UNAVAILABLE \
364 (const xmlChar *)"ietf-subscribed-notifications:stream-unavailable"
365
366/*** ietf-yang-push errors ***/
367
368#define RPC_ERR_APPTAG_PUSH_CANT_EXCLUDE \
369 (const xmlChar *)"ietf-yang-push:cant-exclude"
370
371#define RPC_ERR_APPTAG_PUSH_DATASTORE_NOT_SUBSCRIBABLE \
372 (const xmlChar *)"ietf-yang-push:datastore-not-subscribable"
373
374#define RPC_ERR_APPTAG_PUSH_NO_SUCH_RESYNC \
375 (const xmlChar *)"ietf-yang-push:no-such-subscription-resync"
376
377#define RPC_ERR_APPTAG_PUSH_ON_CHANGE_UNSUPPORTED \
378 (const xmlChar *)"ietf-yang-push:on-change-unsupported"
379
380#define RPC_ERR_APPTAG_PUSH_ON_CHANGE_SYNC_UNSUPPORTED \
381 (const xmlChar *)"ietf-yang-push:on-change-sync-unsupported"
382
383#define RPC_ERR_APPTAG_PUSH_PERIOD_UNSUPPORTED \
384 (const xmlChar *)"ietf-yang-push:period-unsupported"
385
386#define RPC_ERR_APPTAG_PUSH_UPDATE_TOO_BIG \
387 (const xmlChar *)"ietf-yang-push:update-too-big"
388
389#define RPC_ERR_APPTAG_PUSH_SYNC_TOO_BIG \
390 (const xmlChar *)"ietf-yang-push:sync-too-big"
391
392#define RPC_ERR_APPTAG_PUSH_UNCHANGING_SELECTION \
393 (const xmlChar *)"ietf-yang-push:unchanging-selection"
394
395
396#define RPC_ERR_LAST_ERROR RPC_ERR_MALFORMED_MESSAGE
397
398/********************************************************************
399* *
400* T Y P E S *
401* *
402*********************************************************************/
403
405typedef enum rpc_err_t_ {
428
429
435typedef enum rpc_err_sev_t_ {
440
441
447typedef struct rpc_err_info_ {
448 dlq_hdr_t qhdr;
456
461
463 const xmlChar *name;
464
466 xmlChar *dname;
467 boolean isqname;
471 xmlChar *badns;
472 xmlChar *dval;
473 union {
474 const xmlChar *strval;
476 void *cpxval;
477 } v;
479
480
484typedef struct rpc_err_rec_t_ {
486 dlq_hdr_t error_qhdr;
487
490
493
496
499
501 const xmlChar *error_tag;
502
504 const xmlChar *error_app_tag;
505
507 xmlChar *error_path;
508
513
517 const xmlChar *error_message_lang;
518 dlq_hdr_t error_info;
520
521
522/********************************************************************
523* *
524* F U N C T I O N S *
525* *
526*********************************************************************/
527
528
535extern const xmlChar *
537
538
545extern rpc_err_t
546 rpc_err_get_errtag_enum (const xmlChar *errtag);
547
548
554extern rpc_err_rec_t *
555 rpc_err_new_record (void);
556
557
563extern void
565
566
572extern void
574
575
581extern void
583
584
590extern rpc_err_info_t *
591 rpc_err_new_info (void);
592
593
599extern void
601
602
609extern void
610 rpc_err_dump_errors (const rpc_msg_t *msg, log_debug_t lvl);
611
612
613
619extern void
621
622
629extern const xmlChar *
631
632
638extern void
639 rpc_err_clean_errQ (dlq_hdr_t *errQ);
640
641
648extern boolean
649 rpc_err_any_errors (const rpc_msg_t *msg);
650
651
655#ifdef __cplusplus
656} /* end extern 'C' */
657#endif
658
659#endif /* _H_rpc_err */
dlq provides general double-linked list and queue support:
log_debug_t
The debug level enumerations used in util/log.c.
Definition: log.h:345
status_t
global error return code
Definition: status_enum.h:210
uint16 xmlns_id_t
integer handle for registered namespaces
Definition: xmlns.h:89
ncx_btype_t
enumeration of the built-in NCX types These types cannot be overridden and cannot be imported
Definition: ncxtypes.h:213
ncx_layer_t
Enumeration of NETCONF protocol layers.
Definition: ncxtypes.h:507
const xmlChar * rpc_err_get_errtag(rpc_err_t errid)
Get the RPC error-tag for an rpc_err_t enumeration.
Definition: rpc_err.c:300
void rpc_err_clean_errQ(dlq_hdr_t *errQ)
Clean all the entries from a Q of rpc_err_rec_t.
Definition: rpc_err.c:629
rpc_err_rec_t * rpc_err_new_record(void)
Malloc and init an rpc_err_rec_t struct.
Definition: rpc_err.c:354
rpc_err_sev_t
enumerations for NETCONF standard error severities
Definition: rpc_err.h:435
rpc_err_t
enumerations for NETCONF standard errors
Definition: rpc_err.h:405
rpc_err_t rpc_err_get_errtag_enum(const xmlChar *errtag)
Get the RPC error-tag enum for an error-tag string.
Definition: rpc_err.c:323
void rpc_err_clean_record(rpc_err_rec_t *err)
Clean an rpc_err_rec_t struct.
Definition: rpc_err.c:436
const xmlChar * rpc_err_get_severity(rpc_err_sev_t sev)
Translate an rpc_err_sev_t to a string.
Definition: rpc_err.c:604
rpc_err_info_t * rpc_err_new_info(void)
Malloc and init an rpc_err_info_t struct.
Definition: rpc_err.c:476
void rpc_err_dump_errors(const rpc_msg_t *msg, log_debug_t lvl)
Dump the error messages in the RPC message error Q.
Definition: rpc_err.c:547
void rpc_err_free_record(rpc_err_rec_t *err)
Clean and free an rpc_err_rec_t struct.
Definition: rpc_err.c:408
void rpc_err_init_record(rpc_err_rec_t *err)
Init an rpc_err_rec_t struct.
Definition: rpc_err.c:384
void rpc_err_dump_errors_audit(const rpc_msg_t *msg)
Dump the error messages in the RPC message error Q to AUDIT LOG.
Definition: rpc_err.c:575
void rpc_err_free_info(rpc_err_info_t *errinfo)
Clean and free an rpc_err_info_t struct.
Definition: rpc_err.c:499
boolean rpc_err_any_errors(const rpc_msg_t *msg)
Check if there are any errors in the RPC message error Q.
Definition: rpc_err.c:658
@ RPC_ERR_SEV_ERROR
error (only used value)
Definition: rpc_err.h:438
@ RPC_ERR_SEV_NONE
not set
Definition: rpc_err.h:436
@ RPC_ERR_SEV_WARNING
warning
Definition: rpc_err.h:437
@ RPC_ERR_DATA_MISSING
data-missing
Definition: rpc_err.h:422
@ RPC_ERR_MALFORMED_MESSAGE
malformed-message
Definition: rpc_err.h:426
@ RPC_ERR_IN_USE
in-use
Definition: rpc_err.h:407
@ RPC_ERR_UNKNOWN_ELEMENT
unknown-element
Definition: rpc_err.h:415
@ RPC_ERR_LOCK_DENIED
lock-denied
Definition: rpc_err.h:418
@ RPC_ERR_RESOURCE_DENIED
resource-denied
Definition: rpc_err.h:419
@ RPC_ERR_OPERATION_FAILED
operation-failed
Definition: rpc_err.h:424
@ RPC_ERR_PARTIAL_OPERATION
partial-operation, deprecated; not used
Definition: rpc_err.h:425
@ RPC_ERR_BAD_ELEMENT
bad-element
Definition: rpc_err.h:414
@ RPC_ERR_BAD_ATTRIBUTE
bad-attribute
Definition: rpc_err.h:411
@ RPC_ERR_ROLLBACK_FAILED
rollback-failed
Definition: rpc_err.h:420
@ RPC_ERR_MISSING_ELEMENT
missing-element
Definition: rpc_err.h:413
@ RPC_ERR_DATA_EXISTS
data-exists
Definition: rpc_err.h:421
@ RPC_ERR_ACCESS_DENIED
access-denied
Definition: rpc_err.h:417
@ RPC_ERR_TOO_BIG
too-big
Definition: rpc_err.h:409
@ RPC_ERR_MISSING_ATTRIBUTE
missing-attribute
Definition: rpc_err.h:410
@ RPC_ERR_INVALID_VALUE
invalid-value
Definition: rpc_err.h:408
@ RPC_ERR_UNKNOWN_NAMESPACE
unknown-namespace
Definition: rpc_err.h:416
@ RPC_ERR_NONE
not set
Definition: rpc_err.h:406
@ RPC_ERR_UNKNOWN_ATTRIBUTE
unknown-attribute
Definition: rpc_err.h:412
@ RPC_ERR_OPERATION_NOT_SUPPORTED
operation-not-supported
Definition: rpc_err.h:423
YANG module data structures Many internal representations of YANG module constructs.
NETCONF protocol remote procedure call common definitions.
one error-info sub-element
Definition: rpc_err.h:447
xmlChar * dname
malloced name if needed
Definition: rpc_err.h:466
xmlChar * dval
internal saved value
Definition: rpc_err.h:472
xmlChar * badns
if val_nsid INVALID namespace
Definition: rpc_err.h:471
ncx_btype_t val_btype
value base type
Definition: rpc_err.h:468
void * cpxval
val_value_t
Definition: rpc_err.h:476
dlq_hdr_t qhdr
queue header
Definition: rpc_err.h:448
const xmlChar * strval
for string error content
Definition: rpc_err.h:474
ncx_num_t numval
for number error content
Definition: rpc_err.h:475
const xmlChar * name
error info name
Definition: rpc_err.h:463
boolean isqname
val_nsid + v.strval == QName
Definition: rpc_err.h:467
uint8 val_digits
num digits, used for decimal64 only
Definition: rpc_err.h:469
xmlns_id_t name_nsid
If user_val is NULL then the following fields must be set properly for special handling funcitons in ...
Definition: rpc_err.h:460
val_value_t * user_val
if the user_val pointer is set then it will be used instead of the individual fields; The user data i...
Definition: rpc_err.h:455
xmlns_id_t val_nsid
value namespace ID
Definition: rpc_err.h:470
One RPC error record built by the server before an <rpc-error> element is generated.
Definition: rpc_err.h:484
status_t error_res
error result status for error-number
Definition: rpc_err.h:489
const xmlChar * error_app_tag
error-app-tag used (may be NULL)
Definition: rpc_err.h:504
dlq_hdr_t error_qhdr
queue header
Definition: rpc_err.h:486
dlq_hdr_t error_info
Q of rpc_err_info_t.
Definition: rpc_err.h:518
const xmlChar * error_tag
error-tag used
Definition: rpc_err.h:501
xmlChar * error_message
error message usually from status.c but can be set by CLI and YANG extension errmsg
Definition: rpc_err.h:512
xmlChar * error_path
error-path can be NULL if unknown or not applicable
Definition: rpc_err.h:507
const xmlChar * error_message_lang
error message language usually EN-US but can be changed by CLI
Definition: rpc_err.h:517
rpc_err_t error_id
RPC error code.
Definition: rpc_err.h:495
ncx_layer_t error_type
error protocol layer
Definition: rpc_err.h:492
rpc_err_sev_t error_severity
severity (always error for now)
Definition: rpc_err.h:498
NETCONF Server and Client RPC Request/Reply Message Header.
Definition: rpc.h:181
one value to match one type
Definition: val.h:912
union of all the basic number types if float not supported, then it is stored as an int64
Definition: ncxtypes.h:780