/
C Configd Client Library

C Configd Client Library

Introduction

Please refer to Configd Client Library for the general concepts behind the API. This document will cover only C specifics. It is not recommended that the C configd API is used in end user code; it is very low level and path creation can be tricky to do correctly. A path in this API is a "/" separated string where each element is URL escaped.

Mechanics

Before we can use the configd API we need to establish a connection to the daemon, one uses "configd_open_connection" to do this. The "configd_close_connection" function will terminate the connection.

#include <vyatta-cfg/client/connect.h> int main(int argc, char **argv) { struct configd_conn conn; if (configd_open_connection(&conn) != 0) { fprintf(stderr, "failed to open configd connection"); return -1; } configd_close_connection(&conn); }

Once connected we can do a variety of actions on the system, one can configure the device, request the operational state of the device, or perform feature specific RPCs. When configuring the device via the Configd APIs one follows much the same procedure as with the CLI. One creates a configuration session, makes changes, commits those changes, then tears down the session. One may view the RUNNING datastore without a session being created. Sessions persist process exit and must be explicitly removed with "configd_sess_teardown". The minimal configuration application looks like the following.

#define _GNU_SOURCE #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <vyatta-cfg/client/connect.h> #include <vyatta-cfg/client/error.h> #include <vyatta-cfg/client/session.h> int main(int argc, char **argv) { struct configd_conn conn; struct configd_error err = {0}; if (configd_open_connection(&conn) != 0) { fprintf(stderr, "failed to open configd connection\n"); return -1; } pid_t pid = getpid(); char *sess_id = NULL; asprintf(&sess_id, "%d", pid); configd_set_session_id(&conn, sess_id); free(sess_id); if (configd_sess_setup(&conn, &err) != 0) { fprintf(stderr, "failed to setup session %s\n", err.text); return -1; } //do something with the config if (configd_sess_teardown(&conn, &err) != 0) { fprintf(stderr, "failed to teardown session %s\n", err.text); return -1; } configd_error_free(&err); configd_close_connection(&conn); }

From here, one may perform actions similar to what one does on the CLI. Since the interface here is meant for programatic interaction, one may also introspect on the data-model and the current state of the candidate tree to determine available actions, this is similar to using "tab-completion" to inspect the CLI.

Examples

Configuration

The following example uses the C configd API to set all dataplane interfaces to listen for DHCP addresses if no other address is assigned to that interface. While this is a silly thing to do, it demonstrates the basic mechanics of the this API.

#define _GNU_SOURCE #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <vyatta-cfg/client/connect.h> #include <vyatta-cfg/client/error.h> #include <vyatta-cfg/client/node.h> #include <vyatta-cfg/client/rpc.h> #include <vyatta-cfg/client/session.h> #include <vyatta-cfg/client/transaction.h> #include <vyatta-util/vector.h> static int setup_interface_address(struct configd_conn *conn, const char *intf, struct configd_error *err) { int rc = 0; char *path = NULL; char *dhcp_path = NULL; asprintf(&path, "/interfaces/dataplane/%s/address", intf); asprintf(&dhcp_path, "/interfaces/dataplane/%s/address/dhcp", intf); printf("%s:", intf); struct vector *addrs = configd_node_get(conn, AUTO, path, err); if (!addrs) { rc = -1; goto out; } const char *addr = NULL; if ((addr = vector_next(addrs, addr)) != NULL) { printf("%s", addr); while ((addr = vector_next(addrs, addr))) { printf(", %s", addr); } } printf("\n"); if (vector_count(addrs) == 0) { char *out = configd_set(conn, dhcp_path, err); if (!out) { rc = -1; goto free_vector; } free(out); } free_vector: vector_free(addrs); out: free(path); free(dhcp_path); return rc; } int main(int argc, char **argv) { int rc = 0; struct configd_conn conn; struct configd_error err = {0}; if (configd_open_connection(&conn) != 0) { fprintf(stderr, "failed to open configd connection\n"); return -1; } pid_t pid = getpid(); char *sess_id = NULL; asprintf(&sess_id, "%d", pid); configd_set_session_id(&conn, sess_id); free(sess_id); if (configd_sess_setup(&conn, &err) != 0) { fprintf(stderr, "failed to setup session %s\n", err.text); rc = -1; goto done; } struct vector * intfs = configd_node_get(&conn, AUTO, "/interfaces/dataplane", &err); if (!intfs) { fprintf(stderr, "%s\n", err.text); rc = -1; goto done; } const char *intf = NULL; while ((intf = vector_next(intfs, intf)) != NULL) { if (setup_interface_address(&conn, intf, &err) != 0) { fprintf(stderr, "%s\n", err.text); rc = -1; goto free_vector; } } char *out = configd_commit(&conn, "setup interface addresses", &err); if (!out) { fprintf(stderr, "%s\n", err.text); rc = -1; goto free_vector; } else { printf("%s\n", out); free(out); } if (configd_sess_teardown(&conn, &err) != 0) { fprintf(stderr, "failed to teardown session %s\n", err.text); rc = -1; } free_vector: vector_free(intfs); done: configd_error_free(&err); configd_close_connection(&conn); return rc; }

Below is a sample run of the above application.

$ gcc -std=c11 -lvyatta-config -lvyatta-util -o configdapi configdapi.c $ ./configdapi dp0s3:10.156.58.201/23 dp0s10: dp0s11: [interfaces dataplane dp0s10 address dhcp] Starting DHCP client on dp0s10 ... [interfaces dataplane dp0s11 address dhcp] Starting DHCP client on dp0s11 ...

RPC

One can also call an RPC via this interface.

#include <stdio.h> #include <jansson.h> #include <vyatta-cfg/client/connect.h> #include <vyatta-cfg/client/error.h> #include <vyatta-cfg/client/callrpc.h> int main(int argc, char **argv) { int rc = 0; struct configd_conn conn; struct configd_error err = {0}; if (configd_open_connection(&conn) != 0) { fprintf(stderr, "failed to open configd connection\n"); return -1; } json_t *input = json_pack("{s:s}", "host", "1.1.1.1"); char *inputs = json_dumps(input, JSON_COMPACT); json_decref(input); char *outputs = configd_call_rpc(&conn, "vyatta-op-v1", "ping", inputs, &err); if (!outputs) { fprintf(stderr, "%s\n", err.text); rc = -1; goto done; } json_error_t jerr; json_t *output = json_loads(outputs, 0, &jerr); if (!output) { fprintf(stderr, "%s\n", jerr.text); rc = -1; goto done; } int rx_packet_count = 0; json_unpack(output, "{s:i}", "rx-packet-count", &rx_packet_count); json_decref(output); printf("rx-packet-count %d\n", rx_packet_count); done: free(outputs); free(inputs); configd_error_free(&err); configd_close_connection(&conn); return rc; }

Below is an example run of the RPC application.

$ gcc -std=c11 -lvyatta-config -lvyatta-util $(pkg-config --cflags --libs jansson) -o configdapi configdapi.c $ ./configdapi rx-packet-count 3

Operational State Data

Finally one may query for operational data information.

#include <stdio.h> #include <jansson.h> #include <vyatta-cfg/client/connect.h> #include <vyatta-cfg/client/error.h> #include <vyatta-cfg/client/node.h> #include <vyatta-cfg/client/rpc.h> int main(int argc, char **argv) { int rc = 0; struct configd_conn conn; struct configd_error err = {0}; if (configd_open_connection(&conn) != 0) { fprintf(stderr, "failed to open configd connection\n"); return -1; } char *trees = configd_tree_get_full_encoding(&conn, AUTO, "/system/state/platform", "rfc7951", &err); json_error_t jerr; json_t *tree = json_loads(trees, 0, &jerr); if (!tree) { fprintf(stderr, "%s\n", jerr.text); rc = -1; goto done; } const char *os_release = NULL; json_unpack(tree, "{s:{s:s}}", "vyatta-system-v1:platform", "os-release", &os_release); if (os_release) { printf("OS Release: %s\n", os_release); } json_decref(tree); done: free(trees); configd_error_free(&err); configd_close_connection(&conn); return rc; }

Below is an example execution of this program.

$ gcc -std=c11 -lvyatta-config -lvyatta-util $(pkg-config --cflags --libs jansson) -o configdapi configdapi.c $ ./configdapi OS Release: Vyatta:Master



Man Page

The following documentation was generated automatically using Doxygen.

auth.h

src/client/auth.h(3) Vyatta Configuration System src/client/auth.h(3) NAME src/client/auth.h SYNOPSIS Functions struct map * configd_auth_getperms (struct configd_conn *, struct configd_error *error) int configd_auth_authorized (struct configd_conn *conn, const char *cpath, uint perm, struct configd_error *error) Function Documentation struct map* configd_auth_getperms (struct configd_conn *, struct configd_error * error) configd_auth_getperms returns the matched portion of the auth ruleset for a given user as a map from path to permission. On error the return value is NULL, and if the error strut pointer is non NULL then it will be populated. int configd_auth_authorized (struct configd_conn * conn, const char * cpath, uint perm, struct configd_error * error) configd_auth_authorized takes a '/' separated path and permission type and tests that the connected user is authorized to preform the action. The return values are 0:false, 1:true, -1:error. On error if an error struct pointer is non NULL the error will be populated. Author Generated automatically by Doxygen for Vyatta Configuration System from the source code. Version Version 0.104 Tue Jun 2 2020 src/client/auth.h(3)



callrpc.h

src/client/callrpc.h(3) Vyatta Configuration System src/client/callrpc.h(3) NAME src/client/callrpc.h SYNOPSIS Functions char * configd_call_rpc (struct configd_conn *conn, const char *ns, const char *name, const char *input, struct configd_error *error) char * configd_call_rpc_xml (struct configd_conn *conn, const char *ns, const char *name, const char *input, struct configd_error *error) Function Documentation char* configd_call_rpc (struct configd_conn * conn, const char * ns, const char * name, const char * input, struct configd_error * error) configd_call_rpc Takes a namespace, rpc name, and the input to the RPC in JSON format. Returns the output of the RPC in JSON format. On error, returns NULL and if the error struct pointer is non-NULL the error will be filled out. char* configd_call_rpc_xml (struct configd_conn * conn, const char * ns, const char * name, const char * input, struct configd_error * error) configd_call_rpc_xml Takes a namespace, rpc name, and the input to the RPC in XML format. Returns the output of the RPC in XML format. On error, returns NULL and if the error struct pointer is non-NULL the error will be filled out. Author Generated automatically by Doxygen for Vyatta Configuration System from the source code. Version Version 0.104 Tue Jun 2 2020 src/client/callrpc.h(3)

connect.h

src/client/connect.h(3) Vyatta Configuration System src/client/connect.h(3) NAME src/client/connect.h SYNOPSIS #include <stdio.h> #include <stdlib.h> Data Structures struct configd_conn Functions int configd_open_connection (struct configd_conn *) void configd_close_connection (struct configd_conn *) int configd_set_session_id (struct configd_conn *, const char *) Function Documentation int configd_open_connection (struct configd_conn *) configd_open_connection connects to configd. The state for this connection is stored in the configd_conn struct, which must be non NULL. The return values are 0:ok, -1:error. void configd_close_connection (struct configd_conn *) configd_close_connection ends the connection with configd. After this is called the connection struct is no longer valid. int configd_set_session_id (struct configd_conn *, const char *) configd_set_session_id sets the session id for this connection. Typically this is done just after connecting to configd. The session id is a string consisting of numbers representing the connection. Typically the value that is used is the pid of the process. Any unique identifier will work as a connection id. Author Generated automatically by Doxygen for Vyatta Configuration System from the source code. Version Version 0.104 Tue Jun 2 2020 src/client/connect.h(3)



error.h

src/client/error.h(3) Vyatta Configuration System src/client/error.h(3) NAME src/client/error.h SYNOPSIS Data Structures struct configd_error The configd_error struct consists of the error message text and the function it was generated in (source). Functions void configd_error_free (struct configd_error *error) configd_error_free frees the error struct and should be used when the error message is no longer needed. Function Documentation void configd_error_free (struct configd_error * error) configd_error_free frees the error struct and should be used when the error message is no longer needed. Author Generated automatically by Doxygen for Vyatta Configuration System from the source code. Version Version 0.104 Tue Jun 2 2020 src/client/error.h(3)



file.h

src/client/file.h(3) Vyatta Configuration System src/client/file.h(3) NAME src/client/file.h SYNOPSIS Functions char * configd_file_read (struct configd_conn *, const char *filename, struct configd_error *error) char * configd_file_migrate (struct configd_conn *, const char *filename, struct configd_error *error) Function Documentation char* configd_file_read (struct configd_conn *, const char * filename, struct configd_error * error) char* configd_file_migrate (struct configd_conn *, const char * filename, struct configd_error * error) Author Generated automatically by Doxygen for Vyatta Configuration System from the source code. Version Version 0.104 Tue Jun 2 2020 src/client/file.h(3)

node.h

src/client/node.h(3) Vyatta Configuration System src/client/node.h(3) NAME src/client/node.h SYNOPSIS Macros #define CONFIGD_TREEGET_DEFAULTS (1 << 0) #define CONFIGD_TREEGET_SECRETS (1 << 1) #define CONFIGD_TREEGET_ALL (CONFIGD_TREEGET_DEFAULTS|CONFIGD_TREEGET_SECRETS) Functions int configd_node_exists (struct configd_conn *, int DB, const char *path, struct configd_error *) int configd_node_is_default (struct configd_conn *, int DB, const char *path, struct configd_error *) struct vector * configd_node_get (struct configd_conn *, int DB, const char *path, struct configd_error *) int configd_node_get_status (struct configd_conn *, int, const char *, struct configd_error *) int configd_node_get_type (struct configd_conn *, const char *, struct configd_error *) char * configd_node_get_comment (struct configd_conn *, int, const char *, struct configd_error *) char * configd_tree_get_encoding (struct configd_conn *conn, int db, const char *path, const char *encoding, struct configd_error *error) char * configd_tree_get_encoding_flags (struct configd_conn *conn, int db, const char *path, const char *encoding, unsigned int flags, struct configd_error *error) char * configd_tree_get (struct configd_conn *, int, const char *, struct configd_error *) char * configd_tree_get_xml (struct configd_conn *, int, const char *, struct configd_error *) char * configd_tree_get_internal (struct configd_conn *, int, const char *, struct configd_error *) char * configd_tree_get_full_encoding (struct configd_conn *conn, int db, const char *path, const char *encoding, struct configd_error *error) char * configd_tree_get_full_encoding_flags (struct configd_conn *conn, int db, const char *path, const char *encoding, unsigned int flags, struct configd_error *error) char * configd_tree_get_full (struct configd_conn *, int, const char *, struct configd_error *) char * configd_tree_get_full_xml (struct configd_conn *, int, const char *, struct configd_error *) char * configd_tree_get_full_internal (struct configd_conn *, int, const char *, struct configd_error *) char * configd_node_get_complete_env (struct configd_conn *, const char *, struct configd_error *) Macro Definition Documentation #define CONFIGD_TREEGET_DEFAULTS (1 << 0) #define CONFIGD_TREEGET_SECRETS (1 << 1) #define CONFIGD_TREEGET_ALL (CONFIGD_TREEGET_DEFAULTS|CONFIGD_TREEGET_SECRETS) Function Documentation int configd_node_exists (struct configd_conn *, int DB, const char * path, struct configd_error *) configd_node_exists takes a '/' separated path and a database. It returns whether the node at the path is in the database. The return values are 0: false, 1: true, -1: error. On error if the error struct pointer is non NULL the error will be filled out. int configd_node_is_default (struct configd_conn *, int DB, const char * path, struct configd_error *) configd_node_is_default takes a '/' separated path and a database. It returns whether the node at the path in the database is marked as default. The return values are 0: false, 1: true, -1: error. On error if the error struct pointer is non NULL the error will be filled out. struct vector* configd_node_get (struct configd_conn *, int DB, const char * path, struct configd_error *) configd_node_get takes a '/' separated path and a database. It returns a vector consisting of the nodes value or values. Contrary to previous versions of this API this function works on any node type. On error the pointer to the vector will be NULL and if the error struct pointer is non NULL the error will be filled out. int configd_node_get_status (struct configd_conn *, int, const char *, struct configd_error *) configd_node_get_status takes a '/' separated path and a database. It returns the whether the node was 'added', 'deleted', 'changed', or 'unchanged' in this database. The return values are one of the NodeStatus type or -1 on error. On error if the error struct pointer is non NULL the error will be filled out. int configd_node_get_type (struct configd_conn *, const char *, struct configd_error *) configd_node_get_type takes a '/' separated path and a database. It returns the node's type in the tree: 'leaf', 'multi', 'container', or 'tag'. The return values are one of the NodeType type or -1 on error. On error if the error struct pointer is non NULL the error will be filled out. char* configd_node_get_comment (struct configd_conn *, int, const char *, struct configd_error *) configd_node_get_comment takes a '/' separated path and a database. It returns whether the node's comment if one exists or '' otherwise. On error the returned pointer is NULL and if the error struct pointer is non NULL the error will be filled out. char* configd_tree_get_encoding (struct configd_conn * conn, int db, const char * path, const char * encoding, struct configd_error * error) configd_tree_get_encoding takes a '/' separated path and a database. It returns an 'encoding' encoded string representing the configuration (sub)tree requested. On error the pointer returned will be NULL and if the error struct pointer is non NULL the error will be filled out. char* configd_tree_get_encoding_flags (struct configd_conn * conn, int db, const char * path, const char * encoding, unsigned int flags, struct configd_error * error) configd_tree_get_encoding_flags takes a '/' separated path and a database. It returns an 'encoding' encoded string representing the configuration (sub)tree requested containing content based on the specified flags. On error the pointer returned will be NULL and if the error struct pointer is non NULL the error will be filled out. char* configd_tree_get (struct configd_conn *, int, const char *, struct configd_error *) configd_tree_get takes a '/' separated path and a database. It returns a JSON encoded string representing the configuration (sub)tree requested. On error the pointer returned will be NULL and if the error struct pointer is non NULL the error will be filled out. char* configd_tree_get_xml (struct configd_conn *, int, const char *, struct configd_error *) configd_tree_get_xml takes a '/' separated path and a database. It returns a XML encoded string representing the configuration (sub)tree requested. On error the pointer returned will be NULL and if the error struct pointer is non NULL the error will be filled out. char* configd_tree_get_internal (struct configd_conn *, int, const char *, struct configd_error *) configd_tree_get_internal takes a '/' separated path and a database. It returns a JSON encoded string representing the configuration (sub)tree requested. This is encoded such that it will be easy to use from a programmer's point of view. On error the pointer returned will be NULL and if the error struct pointer is non NULL the error will be filled out. char* configd_tree_get_full_encoding (struct configd_conn * conn, int db, const char * path, const char * encoding, struct configd_error * error) configd_tree_get_full_encoding takes a '/' separated path and a database. It returns an 'encoding' encoded string representing the configuration (sub)tree requested. On error the pointer returned will be NULL and if the error struct pointer is non NULL the error will be filled out. char* configd_tree_get_full_encoding_flags (struct configd_conn * conn, int db, const char * path, const char * encoding, unsigned int flags, struct configd_error * error) configd_tree_get_full_encoding_flags takes a '/' separated path and a database. It returns an 'encoding' encoded string representing the configuration (sub)tree requested containing content based on the specified flags. On error the pointer returned will be NULL and if the error struct pointer is non NULL the error will be filled out. char* configd_tree_get_full (struct configd_conn *, int, const char *, struct configd_error *) configd_tree_get_full takes a '/' separated path and a database. It returns a JSON encoded string representing the (sub)tree requested. On error the pointer returned will be NULL and if the error struct pointer is non NULL the error will be filled out. char* configd_tree_get_full_xml (struct configd_conn *, int, const char *, struct configd_error *) configd_tree_get_full_xml takes a '/' separated path and a database. It returns a XML encoded string representing the (sub)tree requested. On error the pointer returned will be NULL and if the error struct pointer is non NULL the error will be filled out. char* configd_tree_get_full_internal (struct configd_conn *, int, const char *, struct configd_error *) configd_tree_get_full_internal takes a '/' separated path and a database. It returns a JSON encoded string representing the (sub)tree requested. This is encoded such that it will be easy to use from a programmer's point of view. On error the pointer returned will be NULL and if the error struct pointer is non NULL the error will be filled out. char* configd_node_get_complete_env (struct configd_conn *, const char *, struct configd_error *) configd_node_get_complete_env returns environement variables used by the completion scripts. The return values are 0:false, 1:true, -1:error. On error if the error struct pointer is non NULL then the error will be populated. Author Generated automatically by Doxygen for Vyatta Configuration System from the source code. Version Version 0.104 Tue Jun 2 2020 src/client/node.h(3)



rpc.h

src/client/rpc.h(3) Vyatta Configuration System src/client/rpc.h(3) NAME src/client/rpc.h SYNOPSIS Enumerations enum Db { AUTO = 0, RUNNING, CANDIDATE, EFFECTIVE } enum NodeStatus { NODE_STATUS_UNCHANGED = 0, NODE_STATUS_CHANGED, NODE_STATUS_ADDED, NODE_STATUS_DELETED } enum NodeType { NODE_TYPE_LEAF = 0, NODE_TYPE_MULTI, NODE_TYPE_CONTAINER, NODE_TYPE_TAG } enum RespT { INIT = 0, STRING, INT, STATUS, VECTOR, MAP, ERROR } enum ShowFlagT { SHOWF_DEFAULTS = 0x01, SHOWF_HIDE_SECRETS = 0x02, SHOWF_CONTEXT_DIFF = 0x04, SHOWF_COMMANDS = 0x08, SHOWF_IGNORE_EDIT = 0x10 } Enumeration Type Documentation enum Db Enumerator AUTO RUNNING CANDIDATE EFFECTIVE enum NodeStatus Enumerator NODE_STATUS_UNCHANGED NODE_STATUS_CHANGED NODE_STATUS_ADDED NODE_STATUS_DELETED enum NodeType Enumerator NODE_TYPE_LEAF NODE_TYPE_MULTI NODE_TYPE_CONTAINER NODE_TYPE_TAG enum RespT Enumerator INIT STRING INT STATUS VECTOR MAP ERROR enum ShowFlagT Enumerator SHOWF_DEFAULTS SHOWF_HIDE_SECRETS SHOWF_CONTEXT_DIFF SHOWF_COMMANDS SHOWF_IGNORE_EDIT Author Generated automatically by Doxygen for Vyatta Configuration System from the source code. Version Version 0.104 Tue Jun 2 2020 src/client/rpc.h(3)



session.h

src/client/session.h(3) Vyatta Configuration System src/client/session.h(3) NAME src/client/session.h SYNOPSIS Functions int configd_sess_exists (struct configd_conn *, struct configd_error *) int configd_sess_setup (struct configd_conn *, struct configd_error *) int configd_sess_teardown (struct configd_conn *, struct configd_error *) int configd_sess_lock (struct configd_conn *conn, struct configd_error *error) int configd_sess_unlock (struct configd_conn *conn, struct configd_error *error) int configd_sess_locked (struct configd_conn *conn, struct configd_error *error) int configd_sess_changed (struct configd_conn *, struct configd_error *) int configd_sess_saved (struct configd_conn *, struct configd_error *) int configd_sess_mark_saved (struct configd_conn *, struct configd_error *) int configd_sess_mark_unsaved (struct configd_conn *, struct configd_error *) char * configd_sess_get_env (struct configd_conn *, struct configd_error *) char * configd_edit_get_env (struct configd_conn *, const char *, struct configd_error *) struct map * configd_get_help (struct configd_conn *conn, int from_schema, const char *cpath, struct configd_error *error) Function Documentation int configd_sess_exists (struct configd_conn *, struct configd_error *) configd_sess_exists returns whether the session id exists. The return values are 0:false, 1:true, -1:error. On error if the error struct pointer is non NULL then the error will be populated. int configd_sess_setup (struct configd_conn *, struct configd_error *) configd_sess_setup creates a new configuration session and corresponding candidate database. The return values are 0:success, -1:error. On error if the error struct pointer is non NULL then the error will be populated. int configd_sess_teardown (struct configd_conn *, struct configd_error *) configd_sess_teardown destroys the configuration session and corresponding candidate database. The return values are 0:success, -1:error. On error if the error struct pointer is non NULL then the error will be populated. int configd_sess_lock (struct configd_conn * conn, struct configd_error * error) configd_sess_lock locks a shared candidate database. The return values are 0:success, -1:error. On error if the error struct pointer is non NULL then the error will be populated. int configd_sess_unlock (struct configd_conn * conn, struct configd_error * error) configd_sess_unlock unlocks a shared candidate database. The return values are 0:success, -1:error. On error if the error struct pointer is non NULL then the error will be populated. int configd_sess_locked (struct configd_conn * conn, struct configd_error * error) configd_sess_locked returns whether the session is currently locked The return values are >0:locked by pid 0:unlocked, -1:error. On error if the error struct pointer is non NULL then the error will be populated. int configd_sess_changed (struct configd_conn *, struct configd_error *) configd_sess_changed returns whether the candidate database for this session id has changes. The return values are 0:false, 1:true, -1:error. On error if the error struct pointer is non NULL then the error will be populated. int configd_sess_saved (struct configd_conn *, struct configd_error *) configd_sess_saved reports whether the candidate database for this session id has been saved. The return values are 0:false, 1:true, -1:error. On error if the error struct pointer is non NULL then the error will be populated. int configd_sess_mark_saved (struct configd_conn *, struct configd_error *) configd_sess_mark_saved marks the database as saved. The return values are 0:success, -1:error. On error if the error struct pointer is non NULL then the error will be populated. int configd_sess_mark_unsaved (struct configd_conn *, struct configd_error *) configd_sess_mark_unsaved marks the database as unsaved. The return values are 0:success, -1:error. On error if the error struct pointer is non NULL then the error will be populated. char* configd_sess_get_env (struct configd_conn *, struct configd_error *) configd_sess_get_env returns the session environment variables that the shell needs in config mode. On error the returned pointer is NULL, and if the error struct pointer is non NULL then the error will be populated. char* configd_edit_get_env (struct configd_conn *, const char *, struct configd_error *) configd_edit_get_env returns the environment variables for the new 'edit mode' that is used by the config mode shell. On error the returned pointer is NULL, and if the error struct pointer is non NULL then the error will be populated. struct map* configd_get_help (struct configd_conn * conn, int from_schema, const char * cpath, struct configd_error * error) configd_get_help returns the a map consisting of the next possible parts of a command and its help text. On error the returned pointer is NULL, and if the error struct pointer is non NULL then the error will be populated. Author Generated automatically by Doxygen for Vyatta Configuration System from the source code. Version Version 0.104 Tue Jun 2 2020 src/client/session.h(3)



template.h

src/client/template.h(3) Vyatta Configuration System src/client/template.h(3) NAME src/client/template.h SYNOPSIS Functions char * configd_schema_get (struct configd_conn *, const char *module, const char *fmt, struct configd_error *error) char * configd_get_schemas (struct configd_conn *, struct configd_error *error) struct map * configd_get_features (struct configd_conn *, struct configd_error *error) struct map * configd_tmpl_get (struct configd_conn *, const char *, struct configd_error *error) struct vector * configd_tmpl_get_children (struct configd_conn *, const char *, struct configd_error *error) struct vector * configd_tmpl_get_allowed (struct configd_conn *, const char *, struct configd_error *error) int configd_tmpl_validate_path (struct configd_conn *, const char *, struct configd_error *error) int configd_tmpl_validate_values (struct configd_conn *, const char *, struct configd_error *error) Function Documentation char* configd_schema_get (struct configd_conn *, const char * module, const char * fmt, struct configd_error * error) char* configd_get_schemas (struct configd_conn *, struct configd_error * error) struct map* configd_get_features (struct configd_conn *, struct configd_error * error) configd_get_features returns a map of schema ids and the corresponding enabled features. On error the returned pointer is NULL, and if the error struct pointer is non NULL the error will be populated. struct map* configd_tmpl_get (struct configd_conn *, const char *, struct configd_error * error) configd_tmpl_get takes a '/' separated path and returns a map consisting of a subset of its template definition. The subset consists of: is_value: whether the node is a value type: the type of the node type2: the secondary type of the node help: the help text string multi: whether the node is a multi tag: whether the node is a tag limit: the limit of nodes for a tag node default: the default value for the node allowed: the allowed field val_help: the val_help field comp_help: the comp_help field secret: whether this node should be treated as sensitive information On error the returned pointer is NULL, and if the error struct pointer is non NULL the error will be populated. NOTE: this api is considered to be unstable and may change as we continue the resturcturing work. struct vector* configd_tmpl_get_children (struct configd_conn *, const char *, struct configd_error * error) configd_tmpl_get_children takes a '/' spearated path and returns a vector containing its children. On error the returned pointer is NULL, and if the error struct pointer is non NULL the error will be populated. NOTE: these are the children of the template and not the values in the database. struct vector* configd_tmpl_get_allowed (struct configd_conn *, const char *, struct configd_error * error) configd_tmpl_get_allowed takes a '/' separated path and returns a vector containing the allowed fields for that node. On error the returned pointer is NULL, and if the error struct pointer is non NULL the error will be populated. NOTE: this evaluates the allowed script to generate the vector of allowed values. int configd_tmpl_validate_path (struct configd_conn *, const char *, struct configd_error * error) configd_tmpl_validate_path takes a '/' separated path and return whether it has a valid template. The return values are 0:false, 1:true, -1:error. On error if the error struct pointer is non NULL the error will be populated. int configd_tmpl_validate_values (struct configd_conn *, const char *, struct configd_error * error) configd_tmpl_validate_path takes a '/' separated path and return whether it has a valid template and the values are valid according to the schema. The return values are 0:false, 1:true, -1:error. On error if the error struct pointer is non NULL the error will be populated. Author Generated automatically by Doxygen for Vyatta Configuration System from the source code. Version Version 0.104 Tue Jun 2 2020 src/client/template.h(3)



transaction.h

src/client/transaction.h(3Vyatta Configuration Systsrc/client/transaction.h(3) NAME src/client/transaction.h SYNOPSIS Functions char * configd_show (struct configd_conn *, int, const char *, const char *, const char *, int, struct configd_error *) char * configd_set (struct configd_conn *, const char *, struct configd_error *) char * configd_validate_path (struct configd_conn *, const char *, struct configd_error *) char * configd_delete (struct configd_conn *, const char *, struct configd_error *) char * configd_rename (struct configd_conn *, const char *, struct configd_error *) char * configd_copy (struct configd_conn *, const char *, struct configd_error *) char * configd_comment (struct configd_conn *, const char *, struct configd_error *) char * configd_commit (struct configd_conn *, const char *, struct configd_error *) char * configd_confirmed_commit (struct configd_conn *, const char *, int, const char *, const char *, const char *, struct configd_error *) char * configd_cancel_commit (struct configd_conn *, const char *, const char *, struct configd_error *) char * configd_discard (struct configd_conn *, struct configd_error *) char * configd_save (struct configd_conn *, const char *, struct configd_error *) int configd_load (struct configd_conn *, const char *, struct configd_error *) int configd_merge (struct configd_conn *, const char *, struct configd_error *) int configd_load_report_warnings (struct configd_conn *, const char *, struct configd_error *) char * configd_validate (struct configd_conn *, struct configd_error *) char * configd_edit_config_xml (struct configd_conn *conn, const char *config_target, const char *default_operation, const char *test_option, const char *error_option, const char *config, struct configd_error *error) Function Documentation char* configd_show (struct configd_conn *, int, const char *, const char *, const char *, int, struct configd_error *) configd_show is a mess, do not rely on it for API calls it is used only in cli-shell-api. char* configd_set (struct configd_conn *, const char *, struct configd_error *) configd_set takes a '/' separated path and attemptes to create it in the candidate database. On error the pointer it returns is set to NULL and if the configd_error struct is non NULL the error is populated. char* configd_validate_path (struct configd_conn *, const char *, struct configd_error *) configd_validate_path takes a '/' separated path and verifies the syntax of the path On error the pointer it returns is set to NULL and if the configd_error struct is non NULL the error is populated. char* configd_delete (struct configd_conn *, const char *, struct configd_error *) configd_delete takes a '/' separated path and attemptes to delete it from the candidate database. On error the pointer it returns is set to NULL and if the configd_error struct is non NULL the error is populated. char* configd_rename (struct configd_conn *, const char *, struct configd_error *) configd_rename takes 2 '/' separated paths and attemptes to rename the first path to the second. On error the pointer it returns is set to NULL and if the configd_error struct is non NULL the error is populated char* configd_copy (struct configd_conn *, const char *, struct configd_error *) configd_copy takes 2 '/' separated paths and attemptes to copy the first path to the second. On error the pointer it returns is set to NULL and if the configd_error struct is non NULL the error is populated char* configd_comment (struct configd_conn *, const char *, struct configd_error *) configd_comment takes a '/' separated path and attemptes to create the comment in the candidate database. On error the pointer it returns is set to NULL and if the configd_error struct is non NULL the error is populated. char* configd_commit (struct configd_conn *, const char *, struct configd_error *) configd_commit preforms the commit operation on the candidate database. On error the pointer it returns is set to NULL and if the configd_error struct is non NULL the error is populated. char* configd_confirmed_commit (struct configd_conn *, const char *, int, const char *, const char *, const char *, struct configd_error *) configd_confirmed_commit preforms the commit operation on the candidate database. On error the pointer it returns is set to NULL and if the configd_error struct is non NULL the error is populated. char* configd_cancel_commit (struct configd_conn *, const char *, const char *, struct configd_error *) configd_cancel_commit reverts a pending confirmed commit operation. On error the pointer it returns is set to NULL and if the configd_error struct is non NULL the error is populated. char* configd_discard (struct configd_conn *, struct configd_error *) configd_discard destroys all pending changes in the candidate database. On error the pointer it returns is set to NULL and if the configd_error struct is non NULL the error is populated. char* configd_save (struct configd_conn *, const char *, struct configd_error *) configd_save takes a filesystem path and writes the configuration to a file at that location. On error the pointer it returns is set to NULL and if the configd_error struct is non NULL the error is populated. int configd_load (struct configd_conn *, const char *, struct configd_error *) configd_load takes a filesystem path and attempts to read the configuration at that path. On error the pointer it returns is set to NULL and if the configd_error struct is non NULL the error is populated int configd_merge (struct configd_conn *, const char *, struct configd_error *) configd_merge takes a filesystem path and attempts to read configuration segments from that path and adds/replaces these segments to the candidate configuration. On error the pointer it returns is set to NULL and if the configd_error struct is non NULL the error is populated int configd_load_report_warnings (struct configd_conn *, const char *, struct configd_error *) configd_load_report_warnings takes a filesystem path and attempts to read the configuration at that path. On error the pointer it returns is set to NULL and if the configd_error struct is non NULL the error is populated. Additionally, if some line(s) of configuration generate warnings, but no error is reported, a valid pointer is returned along with the error struct populated if provided. char* configd_validate (struct configd_conn *, struct configd_error *) configd_validate preforms the validate operation on the candidate database. On error the pointer it returns is set to NULL and if the configd_error struct is non NULL the error is populated. char* configd_edit_config_xml (struct configd_conn * conn, const char * config_target, const char * default_operation, const char * test_option, const char * error_option, const char * config, struct configd_error * error) configd_edit_config_xml preforms a RFC-6241 edit-config operation. On error the pointer it returns is set to NULL and if the configd_error struct is non NULL the error is populated. Author Generated automatically by Doxygen for Vyatta Configuration System from the source code. Version Version 0.104 Tue Jun 2 2020 src/client/transaction.h(3)

Related content