You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2014/11/20 17:15:00 UTC

[7/9] qpid-proton git commit: PROTON-749: Add the deprecated C APIs back in for backward compatibility.

PROTON-749: Add the deprecated C APIs back in for backward compatibility.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/0fd34e83
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/0fd34e83
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/0fd34e83

Branch: refs/heads/master
Commit: 0fd34e837db645c323fa1407c07ef41642501cbf
Parents: 1b2be03
Author: Andrew Stitcher <as...@apache.org>
Authored: Mon Nov 17 14:34:29 2014 -0500
Committer: Andrew Stitcher <as...@apache.org>
Committed: Wed Nov 19 17:50:26 2014 -0500

----------------------------------------------------------------------
 proton-c/bindings/python/proton.py |  8 ++++++++
 proton-c/include/proton/cproton.i  | 12 ++++++++++++
 proton-c/include/proton/sasl.h     | 23 +++++++++++++++++++++++
 proton-c/src/sasl/sasl.c           | 12 ++++++++++++
 4 files changed, 55 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0fd34e83/proton-c/bindings/python/proton.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton.py b/proton-c/bindings/python/proton.py
index 573ec14..fce3255 100644
--- a/proton-c/bindings/python/proton.py
+++ b/proton-c/bindings/python/proton.py
@@ -3193,6 +3193,14 @@ class SASL(object):
   def mechanisms(self, mechs):
     pn_sasl_mechanisms(self._sasl, mechs)
 
+  # @deprecated
+  def client(self):
+    pn_sasl_client(self._sasl)
+
+  # @deprecated
+  def server(self):
+    pn_sasl_server(self._sasl)
+
   def allow_skip(self, allow):
     pn_sasl_allow_skip(self._sasl, allow)
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0fd34e83/proton-c/include/proton/cproton.i
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/cproton.i b/proton-c/include/proton/cproton.i
index 3c5a1a6..3b347f2 100644
--- a/proton-c/include/proton/cproton.i
+++ b/proton-c/include/proton/cproton.i
@@ -995,6 +995,18 @@ typedef unsigned long int uintptr_t;
   sasl != NULL;
 }
 
+%contract pn_sasl_client(pn_sasl_t *sasl)
+{
+ require:
+  sasl != NULL;
+}
+
+%contract pn_sasl_server(pn_sasl_t *sasl)
+{
+ require:
+  sasl != NULL;
+}
+
 %contract pn_sasl_allow_skip(pn_sasl_t *sasl, bool allow)
 {
  require:

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0fd34e83/proton-c/include/proton/sasl.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/sasl.h b/proton-c/include/proton/sasl.h
index ab64e13..104e156 100644
--- a/proton-c/include/proton/sasl.h
+++ b/proton-c/include/proton/sasl.h
@@ -95,6 +95,29 @@ PN_EXTERN void pn_sasl_mechanisms(pn_sasl_t *sasl, const char *mechanisms);
  */
 PN_EXTERN const char *pn_sasl_remote_mechanisms(pn_sasl_t *sasl);
 
+/**
+ * @deprecated
+ * Configure the SASL layer to act as a SASL client.
+ *
+ * This is now unnecessary, and performs no function. The server/clientness
+ * of the sasl layer is determined from the role of the transport that is used to create
+ * it. The API is retained here so as not to break existing code.
+ *
+ * @param[in] sasl the SASL layer to configure as a client
+ */
+PN_EXTERN void pn_sasl_client(pn_sasl_t *sasl);
+
+/**
+ * @deprecated
+ * Configure the SASL layer to act as a server.
+ *
+ * This is now only necessary for backwards compatibility if creating a server pn_sasl_t
+ * from a pn_transport_t which was created implicitly as a client by pn_transport().
+ *
+ * @param[in] sasl the SASL layer to configure as a server
+ */
+PN_EXTERN void pn_sasl_server(pn_sasl_t *sasl);
+
 /** Configure a SASL server layer to permit the client to skip the SASL exchange.
  *
  * If the peer client skips the SASL exchange (i.e. goes right to the AMQP header)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0fd34e83/proton-c/src/sasl/sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/sasl.c b/proton-c/src/sasl/sasl.c
index 1ee8f9b..4ed9f84 100644
--- a/proton-c/src/sasl/sasl.c
+++ b/proton-c/src/sasl/sasl.c
@@ -197,6 +197,18 @@ ssize_t pn_sasl_recv(pn_sasl_t *sasl0, char *bytes, size_t size)
   }
 }
 
+void pn_sasl_client(pn_sasl_t *sasl)
+{
+}
+
+void pn_sasl_server(pn_sasl_t *sasl0)
+{
+  pni_sasl_t *sasl = get_sasl_internal(sasl0);
+  if (sasl) {
+    sasl->client = false;
+  }
+}
+
 void pn_sasl_allow_skip(pn_sasl_t *sasl0, bool allow)
 {
   pni_sasl_t *sasl = get_sasl_internal(sasl0);


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