qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject [1/4] qpid-dispatch git commit: add database string to base config
Date Mon, 04 Jan 2016 22:30:43 GMT
Repository: qpid-dispatch
Updated Branches:
  refs/heads/foo-pol-01 [created] ed925a919


add database string to base config


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/1b95b4f2
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/1b95b4f2
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/1b95b4f2

Branch: refs/heads/foo-pol-01
Commit: 1b95b4f27910cd02f0d88bd7cefa10611424c03c
Parents: 3256a51
Author: Chuck Rolke <crolke@redhat.com>
Authored: Mon Dec 21 15:32:52 2015 -0500
Committer: Chuck Rolke <crolke@redhat.com>
Committed: Mon Dec 21 15:32:52 2015 -0500

----------------------------------------------------------------------
 python/qpid_dispatch/management/qdrouter.json |  6 ++++++
 src/policy.c                                  | 14 +++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/1b95b4f2/python/qpid_dispatch/management/qdrouter.json
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch/management/qdrouter.json b/python/qpid_dispatch/management/qdrouter.json
index 74f9b77..eb8e599 100644
--- a/python/qpid_dispatch/management/qdrouter.json
+++ b/python/qpid_dispatch/management/qdrouter.json
@@ -1012,6 +1012,12 @@
                     "required": false,
                     "create": true
                 },
+                "policyDb": {
+                    "type": "path",
+                    "description": "The path to the folder that holds policy definition files.",
+		    "required": false,
+                    "create": true
+                },
                 "connectionsProcessed": {"type": "integer", "graph": true},
                 "connectionsDenied": {"type": "integer", "graph": true},
                 "connectionsCurrent": {"type": "integer", "graph": true}

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/1b95b4f2/src/policy.c
----------------------------------------------------------------------
diff --git a/src/policy.c b/src/policy.c
index dbade77..45908bd 100644
--- a/src/policy.c
+++ b/src/policy.c
@@ -88,6 +88,7 @@ struct qd_policy_t {
     qd_log_source_t      *log_source;
                           // configured settings
     int                   max_connection_limit;
+    char                 *policyDb;
                           // live statistics
     int                   connections_processed;
     int                   connections_denied;
@@ -102,6 +103,7 @@ qd_policy_t *qd_policy(qd_dispatch_t *qd)
     policy->qd                   = qd;
     policy->log_source           = qd_log_source("POLICY");
     policy->max_connection_limit = 0;
+    policy->policyDb             = 0;
     policy->connections_processed= 0;
     policy->connections_denied   = 0;
     policy->connections_current  = 0;
@@ -113,18 +115,28 @@ qd_policy_t *qd_policy(qd_dispatch_t *qd)
 
 void qd_policy_free(qd_policy_t *policy)
 {
+    if (policy->policyDb)
+        free(policy->policyDb);
     free(policy);
 }
 
+#define CHECK() if (qd_error_code()) goto error
+
 //
 //
 qd_error_t qd_entity_configure_policy(qd_policy_t *policy, qd_entity_t *entity)
 {
-    policy->max_connection_limit = qd_entity_opt_long(entity, "maximumConnections", 0);
QD_ERROR_RET();
+    policy->max_connection_limit = qd_entity_opt_long(entity, "maximumConnections", 0);
CHECK();
     if (policy->max_connection_limit < 0)
         return qd_error(QD_ERROR_CONFIG, "maximumConnections must be >= 0");
+    policy->policyDb =
+        qd_entity_opt_string(entity, "policyDb", 0); CHECK();
     qd_log(policy->log_source, QD_LOG_INFO, "Configured maximumConnections: %d", policy->max_connection_limit);
     return QD_ERROR_NONE;
+
+error:
+    qd_policy_free(policy);
+    return qd_error_code();
 }
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message