summaryrefslogtreecommitdiff
path: root/src/common/defs.h
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2008-12-15 17:03:00 -0800
committerslioch <slioch@eng-140.vyatta.com>2008-12-15 17:03:00 -0800
commit5da26e172a8c1ed5201527aefddabd6e277e5c03 (patch)
tree17b9536117774b0dfd76969b1b3b0aed82c24117 /src/common/defs.h
parent9ed9edcfe9aef3db9306a0d2b7c24f73831b1149 (diff)
downloadvyatta-cfg-5da26e172a8c1ed5201527aefddabd6e277e5c03.tar.gz
vyatta-cfg-5da26e172a8c1ed5201527aefddabd6e277e5c03.zip
initial checkin of new commit code--building but does not replace original commit. New commit may be accessed through
my_commit2 binary.
Diffstat (limited to 'src/common/defs.h')
-rw-r--r--src/common/defs.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/common/defs.h b/src/common/defs.h
new file mode 100644
index 0000000..b489919
--- /dev/null
+++ b/src/common/defs.h
@@ -0,0 +1,72 @@
+#ifndef __DEFS_H__
+#define __DEFS_H__
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "cli_val.h"
+
+#define boolean int
+
+#define LOWEST_PRIORITY 1000
+
+#define MAX_DEPTH 128
+
+struct Result
+{
+ int _err_code;
+ char *_err_str;
+ int _action;
+};
+
+typedef enum {
+ K_NO_OP = 0x01,
+ K_ACTIVE_OP = 0x02, //as a result of an already created node, but assuming action
+ K_SET_OP = 0x04,
+ K_CREATE_OP = 0x08,
+ K_DEL_OP = 0x10
+} NODE_OPERATION;
+
+#define IS_SET(op) (op & K_SET_OP)
+#define IS_ACTIVE(op) (op & K_ACTIVE_OP)
+#define IS_CREATE(op) (op & K_CREATE_OP)
+#define IS_DELETE(op) (op & K_DEL_OP)
+#define IS_NOOP(op) (op & K_NO_OP)
+#define IS_SET_OR_CREATE(op) ((op & K_SET_OP) || (op & K_CREATE_OP))
+
+/**
+ * keeps both configuration and template data in single structure
+ *
+ **/
+
+/*
+TODO: either port over to new system or retain complete set of cli_val definiaitons.
+remove _actions and rely on def in the future.
+ */
+struct Config
+{
+ boolean _multi;
+ vtw_def _def; //keep this here
+ char* _help;
+ char* _default;
+ char* _path;
+};
+
+/*
+ * is used to define embedded nodes (multi) and leafs
+ */
+struct Data
+{
+ char* _name; //name of this node
+ boolean _value; //is this a value?
+ char* _path;
+ NODE_OPERATION _operation; //no-op, set, or delete
+};
+
+struct VyattaNode
+{
+ struct Data _data;
+ struct Config _config;
+ int _priority; //used for setting priority
+};
+
+#endif //__DEFS_H__