You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kg...@apache.org on 2015/06/18 22:15:06 UTC

[01/50] [abbrv] qpid-proton git commit: PROTON-799: Adjusted the Ruby error macro

Repository: qpid-proton
Updated Branches:
  refs/heads/kgiusti-python3 43a61bb0c -> e7f49fa0a


PROTON-799: Adjusted the Ruby error macro


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

Branch: refs/heads/kgiusti-python3
Commit: ada57d89b0a900b8e8e30e0aec08ae95e145dcf3
Parents: ff235b8
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Thu Feb 19 14:28:54 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Wed Jun 3 16:29:25 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/util/error_handler.rb | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ada57d89/proton-c/bindings/ruby/lib/util/error_handler.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/util/error_handler.rb b/proton-c/bindings/ruby/lib/util/error_handler.rb
index 2f43609..da51214 100644
--- a/proton-c/bindings/ruby/lib/util/error_handler.rb
+++ b/proton-c/bindings/ruby/lib/util/error_handler.rb
@@ -41,7 +41,9 @@ module Qpid::Proton::Util
       end
     end
 
-    def can_raise_error(method_names, error_class = nil)
+    def can_raise_error(method_names, options = {})
+      error_class = options[:error_class]
+      below = options[:below] || 0
       # coerce the names to be an array
       Array(method_names).each do |method_name|
         # if the method doesn't already exist then queue this aliasing
@@ -49,12 +51,12 @@ module Qpid::Proton::Util
           @@to_be_wrapped ||= []
           @@to_be_wrapped << method_name
         else
-          create_exception_handler_wrapper(method_name, error_class)
+          create_exception_handler_wrapper(method_name, error_class, below)
         end
       end
     end
 
-    def create_exception_handler_wrapper(method_name, error_class = nil)
+    def create_exception_handler_wrapper(method_name, error_class = nil, below = 0)
       original_method_name = method_name.to_s
       wrapped_method_name = "_excwrap_#{original_method_name}"
       alias_method wrapped_method_name, original_method_name
@@ -63,7 +65,8 @@ module Qpid::Proton::Util
         # calls to Class.send interfere with Messenger.send
         method = self.method(wrapped_method_name.to_sym)
         rc = method.call(*args, &block)
-        check_for_error(rc, error_class)
+        check_for_error(rc, error_class) if rc < below
+        return rc
       end
     end
 


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


[32/50] [abbrv] qpid-proton git commit: PROTON-490: Add py27 to tox and fix the sdist step

Posted by kg...@apache.org.
PROTON-490: Add py27 to tox and fix the sdist step

(cherry picked from commit e5a8b0418ac15d42e0950f6f14c599a62524db14)


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

Branch: refs/heads/kgiusti-python3
Commit: d09e93e56c56619242d6a4d92107036b9f3fee67
Parents: ce45c3a
Author: Flavio Percoco <fl...@gmail.com>
Authored: Wed Jun 17 16:05:28 2015 +0200
Committer: Ken Giusti <kg...@apache.org>
Committed: Wed Jun 17 11:27:32 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/python/setup.py | 20 +++++++++++++++-----
 proton-c/bindings/python/tox.ini  | 25 +++++++++----------------
 2 files changed, 24 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d09e93e5/proton-c/bindings/python/setup.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/setup.py b/proton-c/bindings/python/setup.py
index e6fbb79..1738a14 100755
--- a/proton-c/bindings/python/setup.py
+++ b/proton-c/bindings/python/setup.py
@@ -98,6 +98,7 @@ class Configure(build_ext):
             return compiler.compiler_type
 
     def bundle_libqpid_proton_extension(self):
+        setup_path = os.path.dirname(os.path.realpath(__file__))
         base = self.get_finalized_command('build').build_base
         build_include = os.path.join(base, 'include')
         install = self.get_finalized_command('install').install_base
@@ -107,11 +108,20 @@ class Configure(build_ext):
         log.info("Using bundled libqpid-proton")
 
         if 'QPID_PROTON_SRC' not in os.environ:
-            bundledir = os.path.join(base, "bundled")
-            if not os.path.exists(bundledir):
-                os.makedirs(bundledir)
-            bundle.fetch_libqpid_proton(bundledir)
-            libqpid_proton_dir = os.path.abspath(os.path.join(bundledir, 'qpid-proton'))
+            if not os.path.exists(os.path.join(setup_path, 'tox.ini')):
+                bundledir = os.path.join(base, "bundled")
+                if not os.path.exists(bundledir):
+                    os.makedirs(bundledir)
+                bundle.fetch_libqpid_proton(bundledir)
+                libqpid_proton_dir = os.path.abspath(os.path.join(bundledir, 'qpid-proton'))
+            else:
+                # This should happen just in **dev** environemnts since
+                # tox.ini is not shipped with the driver. It should only
+                # be triggered when calling `setup.py`. This can happen either
+                # manually or when calling `tox` in the **sdist** step. Tox will
+                # defined the `QPID_PROTON_SRC` itself.
+                proton_c = os.path.join(setup_path, '..', '..', '..')
+                libqpid_proton_dir = os.path.abspath(proton_c)
         else:
             libqpid_proton_dir = os.path.abspath(os.environ['QPID_PROTON_SRC'])
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d09e93e5/proton-c/bindings/python/tox.ini
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/tox.ini b/proton-c/bindings/python/tox.ini
index b2277da..acfa5a1 100644
--- a/proton-c/bindings/python/tox.ini
+++ b/proton-c/bindings/python/tox.ini
@@ -1,13 +1,16 @@
 [tox]
-envlist = build,py34
+envlist = py27,py34
 minversion = 1.4
 skipdist = True
 
 [testenv]
 usedevelop = False
-changedir = {toxinidir}/../../proton-c/include/
+#changedir = {toxinidir}/../../proton-c/include/
 setenv =
     VIRTUAL_ENV={envdir}
+    PKG_CONFIG_PATH=None
+    QPID_PROTON_SRC={toxinidir}/../../../
+    DEBUG=True
 passenv =
     PKG_CONFIG_PATH
     CFLAGS
@@ -20,18 +23,8 @@ commands = flake8
 [testenv:docs]
 commands = python setup.py build_sphinx
 
-[testenv:py34]
-platform = linux
-setenv =
-    VIRTUAL_ENV={envdir}
-    PKG_CONFIG_PATH=None
-    QPID_PROTON_SRC={toxinidir}/../../../
-    DEBUG=True
+[testenv:py27]
+platform = linux|linux2
 
-[testenv:build]
-platform = linux2
-setenv =
-    VIRTUAL_ENV={envdir}
-    PKG_CONFIG_PATH=None
-    QPID_PROTON_SRC={toxinidir}/../../../
-    DEBUG=True
\ No newline at end of file
+[testenv:py34]
+platform = linux|linux2
\ No newline at end of file


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


[16/50] [abbrv] qpid-proton git commit: PROTON-904 Remove the dependency on uuid

Posted by kg...@apache.org.
PROTON-904 Remove the dependency on uuid

Instead of relying on libuuid for uuid generation, let proton-c have a
built-in uuid4 generator to generate a somewhat random name.


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

Branch: refs/heads/kgiusti-python3
Commit: 060b1aa8a0631ce3bdd05bc09374e2d684ccd201
Parents: 1cfeef1
Author: Flavio Percoco <fl...@gmail.com>
Authored: Sat Jun 6 15:56:50 2015 +0200
Committer: Ken Giusti <kg...@apache.org>
Committed: Thu Jun 11 10:38:09 2015 -0400

----------------------------------------------------------------------
 proton-c/CMakeLists.txt            | 24 +----------------
 proton-c/bindings/python/setup.py  | 18 ++++++-------
 proton-c/src/messenger/messenger.c | 42 +++++++++++++++++++++++++++--
 proton-c/src/platform.c            | 48 +++++++++------------------------
 proton-c/src/platform.h            | 19 ++++++-------
 5 files changed, 70 insertions(+), 81 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/060b1aa8/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index b534e86..5b05e38 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -27,6 +27,7 @@ if(WIN32 AND NOT CYGWIN)
   # linking against Windows native libraries, including mingw
   set (PN_WINAPI TRUE)
   set (PLATFORM_LIBS ws2_32 Rpcrt4)
+  list(APPEND PLATFORM_DEFINITIONS "PN_WINAPI")
 endif(WIN32 AND NOT CYGWIN)
 
 # Can't use ${CMAKE_VERSION) as it is not available in all versions of cmake 2.6
@@ -153,29 +154,6 @@ else (CLOCK_GETTIME_IN_LIBC)
   endif (CLOCK_GETTIME_IN_RT)
 endif (CLOCK_GETTIME_IN_LIBC)
 
-CHECK_SYMBOL_EXISTS(uuid_generate "uuid/uuid.h" UUID_GENERATE_IN_LIBC)
-if (UUID_GENERATE_IN_LIBC)
-  list(APPEND PLATFORM_DEFINITIONS "USE_UUID_GENERATE")
-else (UUID_GENERATE_IN_LIBC)
-  CHECK_LIBRARY_EXISTS (uuid uuid_generate "" UUID_GENERATE_IN_UUID)
-  if (UUID_GENERATE_IN_UUID)
-    set (UUID_LIB uuid)
-    list(APPEND PLATFORM_DEFINITIONS "USE_UUID_GENERATE")
-  else (UUID_GENERATE_IN_UUID)
-    CHECK_SYMBOL_EXISTS(uuid_create "uuid.h" UUID_CREATE_IN_LIBC)
-    if (UUID_CREATE_IN_LIBC)
-      list(APPEND PLATFORM_DEFINITIONS "USE_UUID_CREATE")
-    else (UUID_CREATE_IN_LIBC)
-      CHECK_SYMBOL_EXISTS(UuidToString "rpc.h" WIN_UUID)
-      if (WIN_UUID)
-        list(APPEND PLATFORM_DEFINITIONS "USE_WIN_UUID")
-      else (WIN_UUID)
-        message(FATAL_ERROR "No Uuid API found")
-      endif (WIN_UUID)
-    endif (UUID_CREATE_IN_LIBC)
-  endif (UUID_GENERATE_IN_UUID)
-endif (UUID_GENERATE_IN_LIBC)
-
 if (PN_WINAPI)
   CHECK_SYMBOL_EXISTS(strerror_s "string.h" STRERROR_S_IN_WINAPI)
   if (STRERROR_S_IN_WINAPI)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/060b1aa8/proton-c/bindings/python/setup.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/setup.py b/proton-c/bindings/python/setup.py
index 79168d2..84b5a66 100755
--- a/proton-c/bindings/python/setup.py
+++ b/proton-c/bindings/python/setup.py
@@ -157,7 +157,14 @@ class Configure(build_ext):
         # depending on the version. Specifically, lets avoid adding things
         # we don't need.
         sources = []
-        libraries = ['uuid']
+        libraries = []
+        extra_compile_args = [
+            '-std=gnu99',
+            '-Dqpid_proton_EXPORTS',
+            '-DUSE_ATOLL',
+            '-DUSE_CLOCK_GETTIME',
+            '-DUSE_STRERROR_R',
+        ]
 
         for subdir in ['object', 'framing', 'codec', 'dispatcher',
                        'engine', 'events', 'transport',
@@ -230,14 +237,7 @@ class Configure(build_ext):
             # the place. All these compile arguments will be appended to
             # the GCC command. This list of flags is not used during the
             # linking phase.
-            extra_compile_args = [
-                '-std=gnu99',
-                '-Dqpid_proton_EXPORTS',
-                '-DUSE_ATOLL',
-                '-DUSE_CLOCK_GETTIME',
-                '-DUSE_STRERROR_R',
-                '-DUSE_UUID_GENERATE',
-            ],
+            extra_compile_args = extra_compile_args,
 
             # If you need to add flags to the linking phase
             # this is the right place to do it. Just like the compile flags,

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/060b1aa8/proton-c/src/messenger/messenger.c
----------------------------------------------------------------------
diff --git a/proton-c/src/messenger/messenger.c b/proton-c/src/messenger/messenger.c
index f226f7b..ec4fb2c 100644
--- a/proton-c/src/messenger/messenger.c
+++ b/proton-c/src/messenger/messenger.c
@@ -485,13 +485,51 @@ static void pn_connection_ctx_free(pn_connection_t *conn)
 #define pn_tracker_direction(tracker) ((tracker) & (0x1000000000000000))
 #define pn_tracker_sequence(tracker) ((pn_sequence_t) ((tracker) & (0x00000000FFFFFFFF)))
 
+
 static char *build_name(const char *name)
 {
+  static bool seeded = false;
+  // UUID standard format: 8-4-4-4-12 (36 chars, 32 alphanumeric and 4 hypens)
+  static const char *uuid_fmt = "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X";
+
+  int count = 0;
+  char *generated;
+  uint8_t bytes[16];
+  unsigned int r = 0;
+
   if (name) {
     return pn_strdup(name);
-  } else {
-    return pn_i_genuuid();
   }
+
+  if (!seeded) {
+    int pid = pn_i_getpid();
+    srand(pn_i_now() + pid);
+    seeded = true;
+  }
+
+  while (count < 16) {
+    if (!r) {
+      r =  (unsigned int) rand();
+    }
+
+    bytes[count] = r & 0xFF;
+    r >>= 8;
+    count++;
+  }
+
+  // From RFC4122, the version bits are set to 0100
+  bytes[6] = (bytes[6] & 0x0F) | 0x40;
+
+  // From RFC4122, the top two bits of byte 8 get set to 01
+  bytes[8] = (bytes[8] & 0x3F) | 0x80;
+
+  generated = (char *) malloc(37*sizeof(char));
+  sprintf(generated, uuid_fmt,
+	  bytes[0], bytes[1], bytes[2], bytes[3],
+	  bytes[4], bytes[5], bytes[6], bytes[7],
+	  bytes[8], bytes[9], bytes[10], bytes[11],
+	  bytes[12], bytes[13], bytes[14], bytes[15]);
+  return generated;
 }
 
 struct pn_link_ctx_t {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/060b1aa8/proton-c/src/platform.c
----------------------------------------------------------------------
diff --git a/proton-c/src/platform.c b/proton-c/src/platform.c
index 8f8ac5f..5470c5a 100644
--- a/proton-c/src/platform.c
+++ b/proton-c/src/platform.c
@@ -22,6 +22,18 @@
 #include "platform.h"
 #include "util.h"
 
+#ifdef PN_WINAPI
+#include <windows.h>
+int pn_i_getpid() {
+  return (int) GetCurrentProcessId();
+}
+#else
+#include <unistd.h>
+int pn_i_getpid() {
+  return (int) getpid();
+}
+#endif
+
 /* Allow for systems that do not implement clock_gettime()*/
 #ifdef USE_CLOCK_GETTIME
 #include <time.h>
@@ -53,42 +65,6 @@ pn_timestamp_t pn_i_now(void)
 }
 #endif
 
-#ifdef USE_UUID_GENERATE
-#include <uuid/uuid.h>
-#include <stdlib.h>
-char* pn_i_genuuid(void) {
-    char *generated = (char *) malloc(37*sizeof(char));
-    uuid_t uuid;
-    uuid_generate(uuid);
-    uuid_unparse(uuid, generated);
-    return generated;
-}
-#elif USE_UUID_CREATE
-#include <uuid.h>
-char* pn_i_genuuid(void) {
-    char *generated;
-    uuid_t uuid;
-    uint32_t rc;
-    uuid_create(&uuid, &rc);
-    // Under FreeBSD the returned string is newly allocated from the heap
-    uuid_to_string(&uuid, &generated, &rc);
-    return generated;
-}
-#elif USE_WIN_UUID
-#include <rpc.h>
-char* pn_i_genuuid(void) {
-    unsigned char *generated;
-    UUID uuid;
-    UuidCreate(&uuid);
-    UuidToString(&uuid, &generated);
-    char* r = pn_strdup((const char*)generated);
-    RpcStringFree(&generated);
-    return r;
-}
-#else
-#error "Don't know how to generate uuid strings on this platform"
-#endif
-
 #ifdef USE_STRERROR_R
 #include <string.h>
 static void pn_i_strerror(int errnum, char *buf, size_t buflen) {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/060b1aa8/proton-c/src/platform.h
----------------------------------------------------------------------
diff --git a/proton-c/src/platform.h b/proton-c/src/platform.h
index 6962493..6a0bbc1 100644
--- a/proton-c/src/platform.h
+++ b/proton-c/src/platform.h
@@ -29,6 +29,14 @@
 extern "C" {
 #endif
 
+/** Get the current PID
+ *
+ * @return process id
+ * @internal
+ */
+int pn_i_getpid(void);
+
+
 /** Get the current time in pn_timestamp_t format.
  *
  * Returns current time in milliseconds since Unix Epoch,
@@ -39,17 +47,6 @@ extern "C" {
  */
 pn_timestamp_t pn_i_now(void);
 
-/** Generate a UUID in string format.
- *
- * Returns a newly generated UUID in the standard 36 char format.
- * The returned char* array is zero terminated.
- * (eg. d797830d-0f5b-49d4-a83f-adaa78425125)
- *
- * @return newly generated stringised UUID
- * @internal
- */
-char* pn_i_genuuid(void);
-
 /** Generate system error message.
  *
  * Populate the proton error structure based on the last system error


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


[06/50] [abbrv] qpid-proton git commit: PROTON-898: Update Ruby bindings to use pn_selectable_get_fd

Posted by kg...@apache.org.
PROTON-898: Update Ruby bindings to use pn_selectable_get_fd

Also removed references to pending and capacity.


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

Branch: refs/heads/kgiusti-python3
Commit: caaabb7bd225aae8d3699ce138ef43c1083782a6
Parents: b49e518
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Mon Jun 1 13:48:09 2015 -0400
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 4 09:11:58 2015 -0400

----------------------------------------------------------------------
 examples/ruby/messenger/nonblocking_recv.rb        | 7 ++-----
 proton-c/bindings/ruby/lib/messenger/selectable.rb | 2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/caaabb7b/examples/ruby/messenger/nonblocking_recv.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/messenger/nonblocking_recv.rb b/examples/ruby/messenger/nonblocking_recv.rb
index 2868b52..09dc3f9 100644
--- a/examples/ruby/messenger/nonblocking_recv.rb
+++ b/examples/ruby/messenger/nonblocking_recv.rb
@@ -76,8 +76,6 @@ loop do
       write_array.delete(sel)
       sel.free
     else
-      sel.capacity
-      sel.pending
       if !sel.registered?
         read_array << sel
         write_array << sel
@@ -102,8 +100,8 @@ loop do
       result.flatten.each do |io|
         sel = selectables[io.fileno]
 
-        sel.writable if sel.pending > 0
-        sel.readable if sel.capacity > 0
+        sel.writable
+        sel.readable
       end
     end
 
@@ -145,4 +143,3 @@ loop do
 end
 
 messenger.stop
-

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/caaabb7b/proton-c/bindings/ruby/lib/messenger/selectable.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/messenger/selectable.rb b/proton-c/bindings/ruby/lib/messenger/selectable.rb
index 9a61317..ec5174f 100644
--- a/proton-c/bindings/ruby/lib/messenger/selectable.rb
+++ b/proton-c/bindings/ruby/lib/messenger/selectable.rb
@@ -44,7 +44,7 @@ module Qpid::Proton::Messenger
     # This can be used in conjunction with the IO class.
     #
     def fileno
-      Cproton.pn_selectable_fd(@impl)
+      Cproton.pn_selectable_get_fd(@impl)
     end
 
     def to_io


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


[36/50] [abbrv] qpid-proton git commit: Merge branch 'master' into kgiusti-python3

Posted by kg...@apache.org.
Merge branch 'master' into kgiusti-python3

Conflicts:
	proton-c/bindings/python/setup.py
	tests/python/proton_tests/sasl.py


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

Branch: refs/heads/kgiusti-python3
Commit: 0d1da5cf90425edce70663f49e4cb31220d65977
Parents: d09e93e 5b611b7
Author: Ken Giusti <kg...@apache.org>
Authored: Wed Jun 17 15:25:57 2015 -0400
Committer: Ken Giusti <kg...@apache.org>
Committed: Wed Jun 17 15:25:57 2015 -0400

----------------------------------------------------------------------
 proton-c/CMakeLists.txt                      |  2 +-
 proton-c/bindings/python/setup.py            | 58 +++++++++++++++++++++--
 proton-c/bindings/python/setuputils/misc.py  |  1 +
 proton-c/bindings/ruby/lib/core/ssl.rb       | 18 ++++---
 proton-c/bindings/ruby/lib/core/transport.rb |  5 +-
 proton-c/bindings/ruby/ruby.i                | 13 +----
 proton-c/src/sasl/sasl-internal.h            |  2 +-
 proton-c/src/sasl/sasl.c                     | 11 +++--
 proton-c/src/windows/schannel.c              | 53 ++++++++++++++++-----
 tests/python/proton_tests/common.py          | 28 ++++++++++-
 tests/python/proton_tests/sasl.py            | 40 ----------------
 11 files changed, 147 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0d1da5cf/proton-c/bindings/python/setup.py
----------------------------------------------------------------------
diff --cc proton-c/bindings/python/setup.py
index 1738a14,0a77872..1620b38
--- a/proton-c/bindings/python/setup.py
+++ b/proton-c/bindings/python/setup.py
@@@ -97,8 -117,22 +117,23 @@@ class Configure(build_ext)
          else:
              return compiler.compiler_type
  
+     def prepare_swig_wrap(self):
+         ext = self.distribution.ext_modules[-1]
+ 
+         try:
+             # This will actually call swig to generate the files
+             # and list the sources.
+             self.swig_sources(ext.sources, ext)
+         except (errors.DistutilsExecError, errors.DistutilsPlatformError) as e:
+             if not (os.path.exists('cproton_wrap.c') or
+                     os.path.exists('cproton.py')):
+                 raise e
+ 
+         ext.sources = ext.sources[1:]
+         ext.swig_opts = []
+ 
      def bundle_libqpid_proton_extension(self):
 +        setup_path = os.path.dirname(os.path.realpath(__file__))
          base = self.get_finalized_command('build').build_base
          build_include = os.path.join(base, 'include')
          install = self.get_finalized_command('install').install_base

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0d1da5cf/tests/python/proton_tests/common.py
----------------------------------------------------------------------
diff --cc tests/python/proton_tests/common.py
index 8bb3609,11bea85..857cb50
--- a/tests/python/proton_tests/common.py
+++ b/tests/python/proton_tests/common.py
@@@ -26,28 -26,8 +26,29 @@@ import sys, os, string, subproces
  from proton import Connection, Transport, SASL, Endpoint, Delivery, SSL
  from proton.reactor import Container
  from proton.handlers import CHandshaker, CFlowController
+ from string import Template
  
 +if sys.version_info[0] == 2 and sys.version_info[1] < 6:
 +    # this is for compatibility, apparently the version of jython we
 +    # use doesn't have the next() builtin.
 +    # we should remove this when we upgrade to a python 2.6+ compatible version
 +    # of jython
 +    #_DEF = object()  This causes the test loader to fail (why?)
 +    class _dummy(): pass
 +    _DEF = _dummy
 +
 +    def next(iter, default=_DEF):
 +        try:
 +            return iter.next()
 +        except StopIteration:
 +            if default is _DEF:
 +                raise
 +            else:
 +                return default
 +    # I may goto hell for this:
 +    import __builtin__
 +    __builtin__.__dict__['next'] = next
 +
  
  def free_tcp_ports(count=1):
    """ return a list of 'count' TCP ports that are free to used (ie. unbound)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0d1da5cf/tests/python/proton_tests/sasl.py
----------------------------------------------------------------------
diff --cc tests/python/proton_tests/sasl.py
index b4e9c7a,7f1e7ad..b5d30ab
--- a/tests/python/proton_tests/sasl.py
+++ b/tests/python/proton_tests/sasl.py
@@@ -16,16 -16,13 +16,14 @@@
  # specific language governing permissions and limitations
  # under the License.
  #
 +from __future__ import absolute_import
  
 -import sys, os, common
 +import sys, os
 +from . import common
- from string import Template
- import subprocess
  
  from proton import *
 -from common import pump, Skipped
 -
 -from cproton import *
 +from .common import pump, Skipped
 +from proton._compat import str2bin
  
  def _sslCertpath(file):
      """ Return the full path to the certificate,keyfile, etc.


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


[04/50] [abbrv] qpid-proton git commit: PROTON-897: Enhance the Ruby examples and README file.

Posted by kg...@apache.org.
PROTON-897: Enhance the Ruby examples and README file.

Added README.md with the goal of turning the examples into a simple
conversation about how to use the Ruby examples.


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

Branch: refs/heads/kgiusti-python3
Commit: ac4731f194a4054525938699475d41398f86fdcb
Parents: 89ef63b
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Tue May 26 15:33:04 2015 -0400
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 4 08:28:46 2015 -0400

----------------------------------------------------------------------
 examples/ruby/messenger/README.md | 163 +++++++++++++++++++++++++++++++++
 1 file changed, 163 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ac4731f1/examples/ruby/messenger/README.md
----------------------------------------------------------------------
diff --git a/examples/ruby/messenger/README.md b/examples/ruby/messenger/README.md
new file mode 100644
index 0000000..7cc8dee
--- /dev/null
+++ b/examples/ruby/messenger/README.md
@@ -0,0 +1,163 @@
+## Simple Messenger Examples
+
+The Messenger APIs, contained in the Qpid::Proton::Messenger class, represent the simplest means for sending and receive messages. An application need only create an instance of Messenger to have an endpoint for sending and receiving messages.
+
+Example applications, currently located in the messenger subdirectory, include:
+
+* **send.rb** - Sends one or more messages to a specific address.
+* **recv.rb** - Listens for messages sent to one or more addresses.
+
+### Sending A Simple Message Directly (Without A Broker)
+
+The goal of this example is to demonstrate how to send and receive messages directly between applications. To do that we've broken out the examples into two applciations: **send.rb** and **recv.rb**.
+
+First we need to start the receiver who will listen for an incoming connection:
+
+```
+ $ ruby recv.rb ~0.0.0.0:8888
+```
+
+**NOTE:** Be sure to include the **tilda (~)** at the beginning of each address to be used. This tells the Messenger that it's going to be listening for connections on that port. And be sure to pick a free port for each of the addresses used.
+
+Now you can send messages with:
+
+```
+ $ ruby send.rb -a 0.0.0.0:8888 "Hello world"
+```
+
+**NOTE:** Here you *don't* use a **tilda (~)** at the beginning of the address since you're specifying the receiver address rather than the address on which to listen.
+
+On the receiver side you should see something like:
+
+```
+Address: 0.0.0.0:8888
+Subject: How are you?
+Body: This is a test.
+Properties: {"sent"=>1432651492, "hostname"=>"mcpierce-laptop"}
+Instructions: {"fold"=>"yes", "spindle"=>"no", "mutilate"=>"no"}
+Annotations: {"version"=>1.0, "pill"=>"RED"}
+
+```
+
+This tells us the message we received as expected.
+
+### Sending A Simple Message Through A Broker
+
+To send a message via an intermediary, such as the Qpid broker, we need to give both the sender and the receiver a little bit more information, such as the hostname and port for the broker and the name of the queue where messages will be sent and received.
+
+If you're using the Qpid broker, this can be done using the **qpid-config**
+tool. Simply start your broker and then create our queue, which we'll call "examples":
+
+```
+ $ qpid-config add queue examples
+```
+
+As of this point you can begin sending messages *without* starting the receiver. This is the benefit of using a broker, the ability to have something store messages for retrieval.
+
+Now let's send a bunch of messages to the queue using **send.rb**:
+
+```
+ $ for which in $(seq 1 10); do ruby send.rb --address amqp://localhost/examples "This is test ${which}."; done
+```
+
+This example sends 10 messages to the our queue on the broker, where they will stay until retrieved.
+
+With this scenario we needed to specify the hostname of the broker and also the name of the queue in the address. After the sending completes you can verify the content of the queue using the **qpid-stat** command:
+
+```
+$ qpid-stat -q
+Queues
+  queue                                     dur  autoDel  excl  msg   msgIn  msgOut  bytes  bytesIn  bytesOut  cons  bind
+  =========================================================================================================================
+  examples                                                        10    10      0    2.65k  2.65k       0         0     1
+  fa4b8acb-03b6-4cff-9277-eeb2efe3c88a:0.0       Y        Y        0     0      0       0      0        0         1     2
+```
+
+Now to retrieve the messages. Start the **recv.rb** example using:
+
+```
+$ ruby recv.rb "amqp://127.0.0.1:5672/examples"
+```
+
+Once it connects to the broker, it will subscribe to the queue and begin receiving messages. You should see something like the following:
+
+```
+Address: amqp://localhost/examples
+Subject: How are you?
+Body: This is test 1.
+Properties: {"sent"=>1432837902, "hostname"=>"mcpierce-laptop"}
+Instructions: {"fold"=>"yes", "spindle"=>"no", "mutilate"=>"no"}
+Annotations: {"version"=>1.0, "pill"=>"RED"}
+Address: amqp://localhost/examples
+Subject: How are you?
+Body: This is test 2.
+Properties: {"sent"=>1432837903, "hostname"=>"mcpierce-laptop"}
+Instructions: {"fold"=>"yes", "spindle"=>"no", "mutilate"=>"no"}
+Annotations: {"version"=>1.0, "pill"=>"RED"}
+Address: amqp://localhost/examples
+Subject: How are you?
+Body: This is test 3.
+... truncating the remainder of the output ...
+```
+
+As with the sending, we specific the protocol to use and the address and port on the host to connect to the broker.
+
+##  Non-Blocking Receive With The Messenger APIs
+
+One of the downsides of Messenger is that, out of the box, it's a blocking set of APIs; i.e., when attempting to receive messages the Ruby VM is halted until the call returns.
+
+Enter **non-blocking mode**!
+
+When working in non-blocking mode you set a flag on your messenger to put it into non-blocking mode.
+
+```
+messenger = Qpid::Proton::Messenger.new
+messenger.passive = true
+```
+
+At this point the application is responsible for monitoring the set of file descriptors associated with those Messengers. It takes a little more code but the benefit is that the application can spawn this in a separate thread and not have the entire VM block during I/O operations. The **nonblocking_recv.rb** example app demonstrates how to perform this properly, how to wrap the file descriptor in a Selectable type, monitor it for when there's data to send or receive and then work with the instance of Messenger.
+
+For more details on how to do this, take a look at the comments in the example application.
+
+
+### Running The Non-Blocking Receiver
+
+To start the non-blocking receiver, simply start the example application like this:
+
+```
+ $ ruby nonblocking_recv.rb ~0.0.0.0:8888
+ This is a side thread:
+The time is now 11:39:24.
+The time is now 11:39:25.
+The time is now 11:39:26.
+```
+
+As the receiver runs it outputs the current time every second to show that a separate thread is running.
+
+Now you can launch the **client.rb** example to send a message to the receiver and then wait for a reply:
+
+```
+ $ ruby client.rb -r "~/#" 0.0.0.0:8888 "This is a test." "Here is my message."
+ amqp://c19f3e88-866a-46ae-8284-d229acf8a5cb/#, RE: This is a test.
+```
+
+As you see, in the command line we specify "~/#" as the address to which any reply should be sent. It's outside of the scope of this example, but the tilda (~) is expanded into a unique address by Proton and used for receiving any responses.
+
+On the receiver side you should see something like this:
+
+```
+The time is now 11:42:04.
+The time is now 11:42:05.
+The time is now 11:42:06.
+Address: 0.0.0.0:8888
+Subject: This is a test.
+Body:
+Properties: {}
+Instructions: {}
+Annotations: {}
+=== Sending a reply to amqp://c19f3e88-866a-46ae-8284-d229acf8a5cb/#
+The time is now 11:42:07.
+The time is now 11:42:08.
+```
+
+Notice in the receiver's output how the reply was sent to the address on the sender that was created by our specifying "~/#"


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


[42/50] [abbrv] qpid-proton git commit: PROTON-842: enforce channel_max limit on session creation

Posted by kg...@apache.org.
PROTON-842: enforce channel_max limit on session creation


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

Branch: refs/heads/kgiusti-python3
Commit: e38957ae5115ec023993672ca5b7d5e3df414f7e
Parents: 175a15a
Author: Mick Goulish <mi...@redhat.com>
Authored: Thu Jun 18 08:45:47 2015 -0400
Committer: Mick Goulish <mi...@redhat.com>
Committed: Thu Jun 18 08:45:47 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/python/proton/__init__.py |   7 +-
 proton-c/include/proton/cproton.i           |   2 -
 proton-c/include/proton/transport.h         |  16 +++-
 proton-c/src/engine/engine-internal.h       |  14 ++-
 proton-c/src/engine/engine.c                |  16 +++-
 proton-c/src/transport/transport.c          | 111 ++++++++++++++++++++---
 tests/python/proton_tests/engine.py         |  44 ++++++++-
 7 files changed, 191 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e38957ae/proton-c/bindings/python/proton/__init__.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/__init__.py b/proton-c/bindings/python/proton/__init__.py
index 9432bd8..5860764 100644
--- a/proton-c/bindings/python/proton/__init__.py
+++ b/proton-c/bindings/python/proton/__init__.py
@@ -2484,7 +2484,11 @@ class Connection(Wrapper, Endpoint):
     """
     Returns a new session on this connection.
     """
-    return Session(pn_session(self._impl))
+    ssn = pn_session(self._impl)
+    if ssn is None:
+      raise(SessionException("Session allocation failed."))
+    else:
+      return Session(ssn)
 
   def session_head(self, mask):
     return Session.wrap(pn_session_head(self._impl, mask))
@@ -3987,6 +3991,7 @@ __all__ = [
            "SASL",
            "Sender",
            "Session",
+           "SessionException",
            "SSL",
            "SSLDomain",
            "SSLSessionDetails",

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e38957ae/proton-c/include/proton/cproton.i
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/cproton.i b/proton-c/include/proton/cproton.i
index ac2b121..b55211f 100644
--- a/proton-c/include/proton/cproton.i
+++ b/proton-c/include/proton/cproton.i
@@ -210,8 +210,6 @@ typedef unsigned long int uintptr_t;
 {
  require:
   connection != NULL;
- ensure:
-  pn_session != NULL;
 }
 
 %contract pn_transport(pn_connection_t *connection)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e38957ae/proton-c/include/proton/transport.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/transport.h b/proton-c/include/proton/transport.h
index a3ca667..483f5a9 100644
--- a/proton-c/include/proton/transport.h
+++ b/proton-c/include/proton/transport.h
@@ -320,6 +320,10 @@ PN_EXTERN void pn_transport_logf(pn_transport_t *transport, const char *fmt, ...
 
 /**
  * Get the maximum allowed channel for a transport.
+ * This will be the minimum of 
+ *   1. limit imposed by this proton implementation
+ *   2. limit imposed by remote peer
+ *   3. limit imposed by this application, using pn_transport_set_channel_max()
  *
  * @param[in] transport a transport object
  * @return the maximum allowed channel
@@ -327,7 +331,17 @@ PN_EXTERN void pn_transport_logf(pn_transport_t *transport, const char *fmt, ...
 PN_EXTERN uint16_t pn_transport_get_channel_max(pn_transport_t *transport);
 
 /**
- * Set the maximum allowed channel for a transport.
+ * Set the maximum allowed channel number for a transport.
+ * Note that this is the maximum channel number allowed, giving a 
+ * valid channel number range of [0..channel_max]. Therefore the 
+ * maximum number of simultaineously active channels will be 
+ * channel_max plus 1.
+ * You can call this function more than once to raise and lower
+ * the limit your application imposes on max channels for this 
+ * transport.  However, smaller limits may be imposed by this
+ * library, or by the remote peer.
+ * After the OPEN frame has been sent to the remote peer,
+ * further calls to this function will have no effect.
  *
  * @param[in] transport a transport object
  * @param[in] channel_max the maximum allowed channel

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e38957ae/proton-c/src/engine/engine-internal.h
----------------------------------------------------------------------
diff --git a/proton-c/src/engine/engine-internal.h b/proton-c/src/engine/engine-internal.h
index 4c72310..c03a0a3 100644
--- a/proton-c/src/engine/engine-internal.h
+++ b/proton-c/src/engine/engine-internal.h
@@ -178,8 +178,20 @@ struct pn_transport_t {
 
   pn_trace_t trace;
 
-  uint16_t channel_max;
+  /*
+   * The maximum channel number can be constrained in several ways:
+   *   1. an unchangeable limit imposed by this library code
+   *   2. a limit imposed by the remote peer when the connection is opened,
+   *      which this app must honor
+   *   3. a limit imposed by this app, which may be raised and lowered
+   *      until the OPEN frame is sent.
+   * These constraints are all summed up in channel_max, below.
+   */
+  #define PN_IMPL_CHANNEL_MAX  32767
+  uint16_t local_channel_max;
   uint16_t remote_channel_max;
+  uint16_t channel_max;
+
   bool freed;
   bool open_sent;
   bool open_rcvd;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e38957ae/proton-c/src/engine/engine.c
----------------------------------------------------------------------
diff --git a/proton-c/src/engine/engine.c b/proton-c/src/engine/engine.c
index c5228a5..936cf60 100644
--- a/proton-c/src/engine/engine.c
+++ b/proton-c/src/engine/engine.c
@@ -953,12 +953,26 @@ static void pn_session_finalize(void *object)
 pn_session_t *pn_session(pn_connection_t *conn)
 {
   assert(conn);
+
+
+  pn_transport_t * transport = pn_connection_transport(conn);
+
+  if(transport) {
+    // channel_max is an index, not a count.  
+    if(pn_hash_size(transport->local_channels) > (size_t)transport->channel_max) {
+      pn_transport_logf(transport, 
+                        "pn_session: too many sessions: %d  channel_max is %d",
+                        pn_hash_size(transport->local_channels),
+                        transport->channel_max);
+      return (pn_session_t *) 0;
+    }
+  }
+
 #define pn_session_free pn_object_free
   static const pn_class_t clazz = PN_METACLASS(pn_session);
 #undef pn_session_free
   pn_session_t *ssn = (pn_session_t *) pn_class_new(&clazz, sizeof(pn_session_t));
   if (!ssn) return NULL;
-
   pn_endpoint_init(&ssn->endpoint, SESSION, conn);
   pni_add_session(conn, ssn);
   ssn->links = pn_list(PN_WEAKREF, 0);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e38957ae/proton-c/src/transport/transport.c
----------------------------------------------------------------------
diff --git a/proton-c/src/transport/transport.c b/proton-c/src/transport/transport.c
index 733f695..ff80e21 100644
--- a/proton-c/src/transport/transport.c
+++ b/proton-c/src/transport/transport.c
@@ -43,6 +43,33 @@ static ssize_t transport_consume(pn_transport_t *transport);
 
 // delivery buffers
 
+/*
+ * Call this any time anything happens that may affect channel_max:
+ * i.e. when the app indicates a preference, or when we receive the
+ * OPEN frame from the remote peer.  And call it to do the final 
+ * calculation just before we communicate our limit to the remote 
+ * peer by sending our OPEN frame.
+ */
+static void pni_calculate_channel_max(pn_transport_t *transport) {
+  /*
+   * The application cannot make the limit larger than 
+   * what this library will allow.
+   */
+  transport->channel_max = (PN_IMPL_CHANNEL_MAX < transport->local_channel_max)
+                           ? PN_IMPL_CHANNEL_MAX
+                           : transport->local_channel_max;
+
+  /*
+   * The remote peer's constraint is not valid until the 
+   * peer's open frame has been received.
+   */
+  if(transport->open_rcvd) {
+    transport->channel_max = (transport->channel_max < transport->remote_channel_max)
+                             ? transport->channel_max
+                             : transport->remote_channel_max;
+  }
+}
+
 void pn_delivery_map_init(pn_delivery_map_t *db, pn_sequence_t next)
 {
   db->deliveries = pn_hash(PN_WEAKREF, 0, 0.75);
@@ -370,7 +397,23 @@ static void pn_transport_initialize(void *object)
   transport->remote_hostname = NULL;
   transport->local_max_frame = PN_DEFAULT_MAX_FRAME_SIZE;
   transport->remote_max_frame = 0;
-  transport->channel_max = 0;
+
+  /*
+   * We set the local limit on channels to 2^15, because 
+   * parts of the code use the topmost bit (of a short)
+   * as a flag.
+   * The peer that this transport connects to may also 
+   * place its own limit on max channel number, and the
+   * application may also set a limit.
+   * The maximum that we use will be the minimum of all 
+   * these constraints.
+   */
+  // There is no constraint yet from remote peer, 
+  // so set to max possible.
+  transport->remote_channel_max = 65535;  
+  transport->local_channel_max  = PN_IMPL_CHANNEL_MAX;
+  transport->channel_max        = transport->local_channel_max;
+
   transport->remote_channel_max = 0;
   transport->local_idle_timeout = 0;
   transport->dead_remote_deadline = 0;
@@ -1098,6 +1141,7 @@ int pn_do_open(pn_transport_t *transport, uint8_t frame_type, uint16_t channel,
     transport->halt = true;
   }
   transport->open_rcvd = true;
+  pni_calculate_channel_max(transport);
   return 0;
 }
 
@@ -1109,6 +1153,18 @@ int pn_do_begin(pn_transport_t *transport, uint8_t frame_type, uint16_t channel,
   int err = pn_data_scan(args, "D.[?HI]", &reply, &remote_channel, &next);
   if (err) return err;
 
+  // AMQP 1.0 section 2.7.1 - if the peer doesn't honor our channel_max -- 
+  // express our displeasure by closing the connection with a framing error.
+  if (remote_channel > transport->channel_max) {
+    pn_do_error(transport,
+                "amqp:connection:framing-error",
+                "remote channel %d is above negotiated channel_max %d.",
+                remote_channel,
+                transport->channel_max
+               );
+    return PN_TRANSPORT_ERROR;
+  }
+
   pn_session_t *ssn;
   if (reply) {
     // XXX: what if session is NULL?
@@ -1774,6 +1830,7 @@ static int pni_process_conn_setup(pn_transport_t *transport, pn_endpoint_t *endp
           : 0;
       pn_connection_t *connection = (pn_connection_t *) endpoint;
       const char *cid = pn_string_get(connection->container);
+      pni_calculate_channel_max(transport);
       int err = pn_post_frame(transport, AMQP_FRAME_TYPE, 0, "DL[SS?I?H?InnCCC]", OPEN,
                               cid ? cid : "",
                               pn_string_get(connection->hostname),
@@ -1792,15 +1849,16 @@ static int pni_process_conn_setup(pn_transport_t *transport, pn_endpoint_t *endp
   return 0;
 }
 
-static uint16_t allocate_alias(pn_hash_t *aliases)
+static uint16_t allocate_alias(pn_hash_t *aliases, uint32_t max_index, int * valid)
 {
-  for (uint32_t i = 0; i < 65536; i++) {
+  for (uint32_t i = 0; i <= max_index; i++) {
     if (!pn_hash_get(aliases, i)) {
+      * valid = 1;
       return i;
     }
   }
 
-  assert(false);
+  * valid = 0;
   return 0;
 }
 
@@ -1828,14 +1886,19 @@ static size_t pni_session_incoming_window(pn_session_t *ssn)
   }
 }
 
-static void pni_map_local_channel(pn_session_t *ssn)
+static int pni_map_local_channel(pn_session_t *ssn)
 {
   pn_transport_t *transport = ssn->connection->transport;
   pn_session_state_t *state = &ssn->state;
-  uint16_t channel = allocate_alias(transport->local_channels);
+  int valid;
+  uint16_t channel = allocate_alias(transport->local_channels, transport->channel_max, & valid);
+  if (!valid) {
+    return 0;
+  }
   state->local_channel = channel;
   pn_hash_put(transport->local_channels, channel, ssn);
   pn_ep_incref(&ssn->endpoint);
+  return 1;
 }
 
 static int pni_process_ssn_setup(pn_transport_t *transport, pn_endpoint_t *endpoint)
@@ -1846,7 +1909,10 @@ static int pni_process_ssn_setup(pn_transport_t *transport, pn_endpoint_t *endpo
     pn_session_state_t *state = &ssn->state;
     if (!(endpoint->state & PN_LOCAL_UNINIT) && state->local_channel == (uint16_t) -1)
     {
-      pni_map_local_channel(ssn);
+      if (! pni_map_local_channel(ssn)) {
+        pn_transport_logf(transport, "unable to find an open available channel within limit of %d", transport->channel_max );
+        return PN_ERR;
+      }
       state->incoming_window = pni_session_incoming_window(ssn);
       state->outgoing_window = pni_session_outgoing_window(ssn);
       pn_post_frame(transport, AMQP_FRAME_TYPE, state->local_channel, "DL[?HIII]", BEGIN,
@@ -1876,12 +1942,17 @@ static const char *expiry_symbol(pn_expiry_policy_t policy)
   return NULL;
 }
 
-static void pni_map_local_handle(pn_link_t *link) {
+static int pni_map_local_handle(pn_link_t *link) {
   pn_link_state_t *state = &link->state;
   pn_session_state_t *ssn_state = &link->session->state;
-  state->local_handle = allocate_alias(ssn_state->local_handles);
+  int valid;
+  // XXX TODO MICK: once changes are made to handle_max, change this hardcoded value to something reasonable.
+  state->local_handle = allocate_alias(ssn_state->local_handles, 65536, & valid);
+  if ( ! valid )
+    return 0;
   pn_hash_put(ssn_state->local_handles, state->local_handle, link);
   pn_ep_incref(&link->endpoint);
+  return 1;
 }
 
 static int pni_process_link_setup(pn_transport_t *transport, pn_endpoint_t *endpoint)
@@ -2574,9 +2645,27 @@ uint16_t pn_transport_get_channel_max(pn_transport_t *transport)
   return transport->channel_max;
 }
 
-void pn_transport_set_channel_max(pn_transport_t *transport, uint16_t channel_max)
+void pn_transport_set_channel_max(pn_transport_t *transport, uint16_t requested_channel_max)
 {
-  transport->channel_max = channel_max;
+  /*
+   * Once the OPEN frame has been sent, we have communicated our 
+   * wishes to the remote client and there is no way to renegotiate.
+   * After that point, we do not allow the application to make changes.
+   * Before that point, however, the app is free to either raise or 
+   * lower our local limit.  (But the app cannot raise it above the 
+   * limit imposed by this library.)
+   * The channel-max value will be finalized just before the OPEN frame
+   * is sent.
+   */
+  if(transport->open_sent) {
+    pn_transport_logf(transport, "Cannot change local channel-max after OPEN frame sent.");
+  }
+  else {
+    transport->local_channel_max = (requested_channel_max < PN_IMPL_CHANNEL_MAX)
+                                   ? requested_channel_max
+                                   : PN_IMPL_CHANNEL_MAX;
+    pni_calculate_channel_max(transport);
+  }
 }
 
 uint16_t pn_transport_remote_channel_max(pn_transport_t *transport)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e38957ae/tests/python/proton_tests/engine.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/engine.py b/tests/python/proton_tests/engine.py
index 924b3bc..1563889 100644
--- a/tests/python/proton_tests/engine.py
+++ b/tests/python/proton_tests/engine.py
@@ -211,11 +211,51 @@ class ConnectionTest(Test):
     assert self.c2.remote_properties == p1, (self.c2.remote_properties, p1)
     assert self.c1.remote_properties == p2, (self.c2.remote_properties, p2)
 
-  def test_channel_max(self, value=1234):
+  # The proton implementation limits channel_max to 32767.
+  # If I set the application's limit lower than that, I should 
+  # get my wish.  If I set it higher -- not.
+  def test_channel_max_low(self, value=1234):
     self.c1.transport.channel_max = value
     self.c1.open()
     self.pump()
-    assert self.c2.transport.remote_channel_max == value, (self.c2.transport.remote_channel_max, value)
+    assert self.c1.transport.channel_max == value, (self.c1.transport.channel_max, value)
+
+  def test_channel_max_high(self, value=33333):
+    self.c1.transport.channel_max = value
+    self.c1.open()
+    self.pump()
+    assert self.c1.transport.channel_max == 32767, (self.c1.transport.channel_max, value)
+
+  def test_channel_max_raise_and_lower(self):
+    # It's OK to lower the max below 32767.
+    self.c1.transport.channel_max = 12345
+    assert self.c1.transport.channel_max == 12345
+    # But it won't let us raise the limit above 32767.
+    self.c1.transport.channel_max = 33333
+    assert self.c1.transport.channel_max == 32767
+    self.c1.open()
+    self.pump()
+    # Now it's too late to make any change, because
+    # we have already sent the OPEN frame.
+    self.c1.transport.channel_max = 666
+    assert self.c1.transport.channel_max == 32767
+
+
+  def test_channel_max_limits_sessions(self):
+    return
+    # This is an index -- so max number of channels should be 1.
+    self.c1.transport.channel_max = 0
+    self.c1.open()
+    self.c2.open()
+    ssn_0 = self.c2.session()
+    assert ssn_0 != None
+    ssn_0.open()
+    self.pump()
+    try:
+      ssn_1 = self.c2.session()
+      assert False, "expected session exception"
+    except SessionException:
+      pass
 
   def test_cleanup(self):
     self.c1.open()


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


[14/50] [abbrv] qpid-proton git commit: PROTON-906: add DurableSubscription option utility

Posted by kg...@apache.org.
PROTON-906: add DurableSubscription option utility


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

Branch: refs/heads/kgiusti-python3
Commit: f252261b971f9bcc64dc4c54de95f9429c5766bc
Parents: aa548c4
Author: Gordon Sim <gs...@redhat.com>
Authored: Wed Jun 10 16:58:28 2015 +0100
Committer: Gordon Sim <gs...@redhat.com>
Committed: Wed Jun 10 16:58:28 2015 +0100

----------------------------------------------------------------------
 proton-c/bindings/python/proton/reactor.py | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f252261b/proton-c/bindings/python/proton/reactor.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/reactor.py b/proton-c/bindings/python/proton/reactor.py
index 0145a25..a7b0717 100644
--- a/proton-c/bindings/python/proton/reactor.py
+++ b/proton-c/bindings/python/proton/reactor.py
@@ -411,6 +411,11 @@ class Selector(Filter):
     def __init__(self, value, name='selector'):
         super(Selector, self).__init__({symbol(name): Described(symbol('apache.org:selector-filter:string'), value)})
 
+class DurableSubscription(ReceiverOption):
+    def apply(self, receiver):
+        receiver.source.durability = Terminus.DELIVERIES
+        receiver.source.expiry_policy = Terminus.EXPIRE_NEVER
+
 class Move(ReceiverOption):
     def apply(self, receiver):
         receiver.source.distribution_mode = Terminus.DIST_MODE_MOVE


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


[08/50] [abbrv] qpid-proton git commit: PROTON-901: add constants in python for pn_expiry_policy_t values

Posted by kg...@apache.org.
PROTON-901: add constants in python for pn_expiry_policy_t values


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

Branch: refs/heads/kgiusti-python3
Commit: 5a6c8da659c7e052e86591a3522e71b2e9e0fda8
Parents: 3db3cf1
Author: Gordon Sim <gs...@redhat.com>
Authored: Fri Jun 5 19:25:13 2015 +0100
Committer: Gordon Sim <gs...@redhat.com>
Committed: Fri Jun 5 19:25:13 2015 +0100

----------------------------------------------------------------------
 proton-c/bindings/python/proton/__init__.py | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5a6c8da6/proton-c/bindings/python/proton/__init__.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/__init__.py b/proton-c/bindings/python/proton/__init__.py
index 5de9510..a4a0e02 100644
--- a/proton-c/bindings/python/proton/__init__.py
+++ b/proton-c/bindings/python/proton/__init__.py
@@ -2771,6 +2771,11 @@ class Terminus(object):
   DIST_MODE_COPY = PN_DIST_MODE_COPY
   DIST_MODE_MOVE = PN_DIST_MODE_MOVE
 
+  EXPIRE_WITH_LINK = PN_EXPIRE_WITH_LINK
+  EXPIRE_WITH_SESSION = PN_EXPIRE_WITH_SESSION
+  EXPIRE_WITH_CONNECTION = PN_EXPIRE_WITH_CONNECTION
+  EXPIRE_NEVER = PN_EXPIRE_NEVER
+
   def __init__(self, impl):
     self._impl = impl
 


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


[18/50] [abbrv] qpid-proton git commit: NO-JIRA: Code tidying

Posted by kg...@apache.org.
NO-JIRA: Code tidying


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

Branch: refs/heads/kgiusti-python3
Commit: 7346d23d7ffbbfa85673be738e0d93bc75a72a2b
Parents: 8108bd7
Author: Andrew Stitcher <as...@apache.org>
Authored: Thu Jun 11 12:14:42 2015 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Thu Jun 11 15:56:36 2015 -0400

----------------------------------------------------------------------
 proton-c/src/sasl/cyrus_sasl.c | 63 +++++++++++++++++--------------------
 1 file changed, 29 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7346d23d/proton-c/src/sasl/cyrus_sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/cyrus_sasl.c b/proton-c/src/sasl/cyrus_sasl.c
index e280324..31703a8 100644
--- a/proton-c/src/sasl/cyrus_sasl.c
+++ b/proton-c/src/sasl/cyrus_sasl.c
@@ -101,25 +101,25 @@ static const sasl_callback_t pni_user_callbacks[] = {
 };
 
 bool pni_init_client(pn_transport_t* transport) {
-    int result;
-    pni_sasl_t *sasl = transport->sasl;
-
+  pni_sasl_t *sasl = transport->sasl;
+  int result;
+  sasl_conn_t *cyrus_conn = NULL;
+  do {
     if (sasl->config_dir) {
-        result = sasl_set_path(SASL_PATH_TYPE_CONFIG, sasl->config_dir);
-        if (result!=SASL_OK) return false;
+      result = sasl_set_path(SASL_PATH_TYPE_CONFIG, sasl->config_dir);
+      if (result!=SASL_OK) break;
     }
 
     result = sasl_client_init(NULL);
-    if (result!=SASL_OK) return false;
+    if (result!=SASL_OK) break;
 
     const sasl_callback_t *callbacks = sasl->username ? sasl->password ? pni_user_password_callbacks : pni_user_callbacks : NULL;
-    sasl_conn_t *cyrus_conn;
     result = sasl_client_new(amqp_service,
                              sasl->remote_fqdn,
                              NULL, NULL,
                              callbacks, 0,
                              &cyrus_conn);
-    if (result!=SASL_OK) return false;
+    if (result!=SASL_OK) break;
     sasl->impl_context = cyrus_conn;
 
     sasl_security_properties_t secprops = {0};
@@ -128,18 +128,19 @@ bool pni_init_client(pn_transport_t* transport) {
     ( transport->auth_required ? SASL_SEC_NOANONYMOUS : 0 ) ;
 
     result = sasl_setprop(cyrus_conn, SASL_SEC_PROPS, &secprops);
-    if (result!=SASL_OK) return false;
+    if (result!=SASL_OK) break;
 
     sasl_ssf_t ssf = sasl->external_ssf;
     result = sasl_setprop(cyrus_conn, SASL_SSF_EXTERNAL, &ssf);
-    if (result!=SASL_OK) return false;
+    if (result!=SASL_OK) break;
 
     const char *extid = sasl->external_auth;
     if (extid) {
       result = sasl_setprop(cyrus_conn, SASL_AUTH_EXTERNAL, extid);
-      if (result!=SASL_OK) return false;
     }
-    return true;
+  } while (false);
+  cyrus_conn = (sasl_conn_t*) sasl->impl_context;
+  return pni_check_sasl_result(cyrus_conn, result, transport);
 }
 
 static int pni_wrap_client_start(pni_sasl_t *sasl, const char *mechs, const char **mechusing)
@@ -233,42 +234,43 @@ void pni_process_challenge(pn_transport_t *transport, const pn_bytes_t *recv)
     }
 }
 
-static int pni_wrap_server_new(pn_transport_t *transport)
+bool pni_init_server(pn_transport_t* transport)
 {
-    pni_sasl_t *sasl = transport->sasl;
-    int result;
-
+  pni_sasl_t *sasl = transport->sasl;
+  int result;
+  sasl_conn_t *cyrus_conn = NULL;
+  do {
     if (sasl->config_dir) {
         result = sasl_set_path(SASL_PATH_TYPE_CONFIG, sasl->config_dir);
-        if (result!=SASL_OK) return result;
+        if (result!=SASL_OK) break;
     }
 
     result = sasl_server_init(NULL, sasl->config_name);
-    if (result!=SASL_OK) return result;
+    if (result!=SASL_OK) break;
 
-    sasl_conn_t *cyrus_conn;
     result = sasl_server_new(amqp_service, NULL, NULL, NULL, NULL, NULL, 0, &cyrus_conn);
-    if (result!=SASL_OK) return result;
+    if (result!=SASL_OK) break;
     sasl->impl_context = cyrus_conn;
 
     sasl_security_properties_t secprops = {0};
     secprops.security_flags =
-    SASL_SEC_NOPLAINTEXT |
-    ( transport->auth_required ? SASL_SEC_NOANONYMOUS : 0 ) ;
+      SASL_SEC_NOPLAINTEXT |
+      ( transport->auth_required ? SASL_SEC_NOANONYMOUS : 0 ) ;
 
     result = sasl_setprop(cyrus_conn, SASL_SEC_PROPS, &secprops);
-    if (result!=SASL_OK) return result;
+    if (result!=SASL_OK) break;
 
     sasl_ssf_t ssf = sasl->external_ssf;
     result = sasl_setprop(cyrus_conn, SASL_SSF_EXTERNAL, &ssf);
-    if (result!=SASL_OK) return result;
+    if (result!=SASL_OK) break;
 
     const char *extid = sasl->external_auth;
     if (extid) {
-      result = sasl_setprop(cyrus_conn, SASL_AUTH_EXTERNAL, extid);
-      if (result!=SASL_OK) return result;
+    result = sasl_setprop(cyrus_conn, SASL_AUTH_EXTERNAL, extid);
     }
-    return result;
+  } while (false);
+  cyrus_conn = (sasl_conn_t*) sasl->impl_context;
+  return pni_check_sasl_result(cyrus_conn, result, transport);
 }
 
 static int pni_wrap_server_start(pni_sasl_t *sasl, const char *mech_selected, const pn_bytes_t *in)
@@ -327,13 +329,6 @@ static void pni_process_server_result(pn_transport_t *transport, int result)
     }
 }
 
-bool pni_init_server(pn_transport_t* transport)
-{
-    int r = pni_wrap_server_new(transport);
-    sasl_conn_t *cyrus_conn = (sasl_conn_t*)transport->sasl->impl_context;
-    return pni_check_sasl_result(cyrus_conn, r, transport);
-}
-
 void pni_process_init(pn_transport_t *transport, const char *mechanism, const pn_bytes_t *recv)
 {
     pni_sasl_t *sasl = transport->sasl;


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


[05/50] [abbrv] qpid-proton git commit: PROTON-897: Enhanced the Ruby nonblocking_recv.rb example

Posted by kg...@apache.org.
PROTON-897: Enhanced the Ruby nonblocking_recv.rb example


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

Branch: refs/heads/kgiusti-python3
Commit: b49e5185c3ffe4a935ba51e4ce4a0e6f5f3ec172
Parents: 267072d
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Thu Jun 4 08:29:09 2015 -0400
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 4 08:29:09 2015 -0400

----------------------------------------------------------------------
 examples/ruby/messenger/nonblocking_recv.rb | 34 +++++++++++++++---------
 1 file changed, 21 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b49e5185/examples/ruby/messenger/nonblocking_recv.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/messenger/nonblocking_recv.rb b/examples/ruby/messenger/nonblocking_recv.rb
index d1fa854..2868b52 100644
--- a/examples/ruby/messenger/nonblocking_recv.rb
+++ b/examples/ruby/messenger/nonblocking_recv.rb
@@ -20,6 +20,14 @@
 require 'qpid_proton'
 require 'optparse'
 
+Thread.new do
+  print "This is a side thread:\n"
+  loop do
+    print "The time is now #{Time.new.strftime('%I:%M:%S')}.\n"
+    sleep 1
+  end
+end
+
 addresses = []
 
 OptionParser.new do |opts|
@@ -37,8 +45,8 @@ messenger.passive = true
 begin
   messenger.start
 rescue ProtonError => error
-  puts "ERROR: #{error.message}"
-  puts error.backtrace.join("\n")
+  print "ERROR: #{error.message}\n"
+  print error.backtrace.join("\n")
   exit
 end
 
@@ -46,7 +54,7 @@ addresses.each do |address|
   begin
     messenger.subscribe(address)
   rescue Qpid::Proton::ProtonError => error
-    puts "ERROR: #{error.message}"
+    print "ERROR: #{error.message}\n"
     exit
   end
 end
@@ -102,7 +110,7 @@ loop do
     begin
       messenger.receive(10)
     rescue Qpid::Proton::ProtonError => error
-      puts "ERROR: #{error.message}"
+      print "ERROR: #{error.message}\n"
       exit
     end
 
@@ -110,24 +118,24 @@ loop do
       begin
         messenger.get(msg)
       rescue Qpid::Proton::Error => error
-        puts "ERROR: #{error.message}"
+        print "ERROR: #{error.message}\n"
         exit
       end
 
-      puts "Address: #{msg.address}"
+      print "Address: #{msg.address}\n"
       subject = msg.subject || "(no subject)"
-      puts "Subject: #{subject}"
-      puts "Body: #{msg.body}"
-      puts "Properties: #{msg.properties}"
-      puts "Instructions: #{msg.instructions}"
-      puts "Annotations: #{msg.annotations}"
+      print "Subject: #{subject}\n"
+      print "Body: #{msg.body}\n"
+      print "Properties: #{msg.properties}\n"
+      print "Instructions: #{msg.instructions}\n"
+      print "Annotations: #{msg.annotations}\n"
 
       if msg.reply_to
-        puts "=== Sending a reply to #{msg.reply_to}"
+        print "=== Sending a reply to #{msg.reply_to}\n"
         reply = Qpid::Proton::Message.new
         reply.address = msg.reply_to
         reply.subject = "RE: #{msg.subject}"
-        reply.content = "Thanks for the message!"
+        reply.body = "Thanks for the message!"
 
         messenger.put(reply)
         messenger.send


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


[12/50] [abbrv] qpid-proton git commit: PROTON-903: align fallback UUID implementation with spec. Patch from Flavio Percoco.

Posted by kg...@apache.org.
PROTON-903: align fallback UUID implementation with spec. Patch from Flavio Percoco.


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

Branch: refs/heads/kgiusti-python3
Commit: 53b9184719762b44843832a642cc090a63f2d71c
Parents: e32f047
Author: Gordon Sim <gs...@redhat.com>
Authored: Tue Jun 9 15:01:36 2015 +0100
Committer: Gordon Sim <gs...@redhat.com>
Committed: Tue Jun 9 15:01:36 2015 +0100

----------------------------------------------------------------------
 proton-c/bindings/python/proton/__init__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/53b91847/proton-c/bindings/python/proton/__init__.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/__init__.py b/proton-c/bindings/python/proton/__init__.py
index a4a0e02..e3cd9e3 100644
--- a/proton-c/bindings/python/proton/__init__.py
+++ b/proton-c/bindings/python/proton/__init__.py
@@ -79,8 +79,8 @@ except ImportError:
     bytes = [rand.randint(0, 255) for i in xrange(16)]
 
     # From RFC4122, the version bits are set to 0100
-    bytes[7] &= 0x0F
-    bytes[7] |= 0x40
+    bytes[6] &= 0x0F
+    bytes[6] |= 0x40
 
     # From RFC4122, the top two bits of byte 8 get set to 01
     bytes[8] &= 0x3F


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


[15/50] [abbrv] qpid-proton git commit: PROTON-866: Tell SASL the external ssf and authid when we detect SASL - Add Internal API to set external ssf/authid to SASL

Posted by kg...@apache.org.
PROTON-866: Tell SASL the external ssf and authid when we detect SASL
- Add Internal API to set external ssf/authid to SASL


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

Branch: refs/heads/kgiusti-python3
Commit: 1cfeef1c03d4607844320320ab50054f750f3aa8
Parents: f252261
Author: Andrew Stitcher <as...@apache.org>
Authored: Tue May 26 15:11:54 2015 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Wed Jun 10 16:41:51 2015 -0400

----------------------------------------------------------------------
 proton-c/src/sasl/cyrus_sasl.c     | 33 ++++++++++++++++++++++++---------
 proton-c/src/sasl/sasl-internal.h  |  3 +++
 proton-c/src/sasl/sasl.c           | 13 +++++++++++++
 proton-c/src/transport/transport.c |  1 +
 4 files changed, 41 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1cfeef1c/proton-c/src/sasl/cyrus_sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/cyrus_sasl.c b/proton-c/src/sasl/cyrus_sasl.c
index 4bf5f4d..e280324 100644
--- a/proton-c/src/sasl/cyrus_sasl.c
+++ b/proton-c/src/sasl/cyrus_sasl.c
@@ -122,6 +122,23 @@ bool pni_init_client(pn_transport_t* transport) {
     if (result!=SASL_OK) return false;
     sasl->impl_context = cyrus_conn;
 
+    sasl_security_properties_t secprops = {0};
+    secprops.security_flags =
+    SASL_SEC_NOPLAINTEXT |
+    ( transport->auth_required ? SASL_SEC_NOANONYMOUS : 0 ) ;
+
+    result = sasl_setprop(cyrus_conn, SASL_SEC_PROPS, &secprops);
+    if (result!=SASL_OK) return false;
+
+    sasl_ssf_t ssf = sasl->external_ssf;
+    result = sasl_setprop(cyrus_conn, SASL_SSF_EXTERNAL, &ssf);
+    if (result!=SASL_OK) return false;
+
+    const char *extid = sasl->external_auth;
+    if (extid) {
+      result = sasl_setprop(cyrus_conn, SASL_AUTH_EXTERNAL, extid);
+      if (result!=SASL_OK) return false;
+    }
     return true;
 }
 
@@ -242,17 +259,15 @@ static int pni_wrap_server_new(pn_transport_t *transport)
     result = sasl_setprop(cyrus_conn, SASL_SEC_PROPS, &secprops);
     if (result!=SASL_OK) return result;
 
-    // EXTERNAL not implemented yet
-    #if 0
-    sasl_ssf_t ssf = 128;
-    result = sasl_setprop(sasl->cyrus_conn, SASL_SSF_EXTERNAL, &ssf);
+    sasl_ssf_t ssf = sasl->external_ssf;
+    result = sasl_setprop(cyrus_conn, SASL_SSF_EXTERNAL, &ssf);
     if (result!=SASL_OK) return result;
 
-    const char *extid = "user";
-    result = sasl_setprop(sasl->cyrus_conn, SASL_AUTH_EXTERNAL, extid);
-    if (result!=SASL_OK) return result;
-    #endif
-
+    const char *extid = sasl->external_auth;
+    if (extid) {
+      result = sasl_setprop(cyrus_conn, SASL_AUTH_EXTERNAL, extid);
+      if (result!=SASL_OK) return result;
+    }
     return result;
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1cfeef1c/proton-c/src/sasl/sasl-internal.h
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/sasl-internal.h b/proton-c/src/sasl/sasl-internal.h
index da180e4..40df261 100644
--- a/proton-c/src/sasl/sasl-internal.h
+++ b/proton-c/src/sasl/sasl-internal.h
@@ -29,6 +29,7 @@
 void pn_sasl_free(pn_transport_t *transport);
 void pni_sasl_set_user_password(pn_transport_t *transport, const char *user, const char *password);
 void pni_sasl_set_remote_hostname(pn_transport_t *transport, const char* fqdn);
+void pni_sasl_set_external_security(pn_transport_t *transport, int ssf, const char *authid);
 
 // Internal SASL authenticator interface
 void pni_sasl_impl_free(pn_transport_t *transport);
@@ -63,6 +64,8 @@ struct pni_sasl_t {
   const char *config_name;
   char *config_dir;
   const char *remote_fqdn;
+  char *external_auth;
+  int external_ssf;
   pn_sasl_outcome_t outcome;
   pn_bytes_t bytes_out;
   enum pni_sasl_state desired_state;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1cfeef1c/proton-c/src/sasl/sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/sasl.c b/proton-c/src/sasl/sasl.c
index e180280..3142832 100644
--- a/proton-c/src/sasl/sasl.c
+++ b/proton-c/src/sasl/sasl.c
@@ -24,6 +24,7 @@
 #include "dispatch_actions.h"
 #include "engine/engine-internal.h"
 #include "protocol.h"
+#include "proton/ssl.h"
 #include "util.h"
 #include "transport/autodetect.h"
 
@@ -87,6 +88,7 @@ static ssize_t pn_input_read_sasl_header(pn_transport_t* transport, unsigned int
     }
     if (transport->trace & PN_TRACE_FRM)
         pn_transport_logf(transport, "  <- %s", "SASL");
+    pni_sasl_set_external_security(transport, pn_ssl_get_ssf((pn_ssl_t*)transport), pn_ssl_get_remote_subject((pn_ssl_t*)transport));
     return SASL_HEADER_LEN;
   case PNI_PROTOCOL_INSUFFICIENT:
     if (!eos) return 0;
@@ -367,6 +369,8 @@ pn_sasl_t *pn_sasl(pn_transport_t *transport)
     sasl->config_name = sasl->client ? "proton-client" : "proton-server";
     sasl->config_dir =  sasl_config_path ? pn_strdup(sasl_config_path) : NULL;
     sasl->remote_fqdn = NULL;
+    sasl->external_auth = NULL;
+    sasl->external_ssf = 0;
     sasl->outcome = PN_SASL_NONE;
     sasl->impl_context = NULL;
     sasl->bytes_out.size = 0;
@@ -417,6 +421,14 @@ void pni_sasl_set_user_password(pn_transport_t *transport, const char *user, con
   sasl->password = password ? pn_strdup(password) : NULL;
 }
 
+void pni_sasl_set_external_security(pn_transport_t *transport, int ssf, const char *authid)
+{
+  pni_sasl_t *sasl = transport->sasl;
+  sasl->external_ssf = ssf;
+  free(sasl->external_auth);
+  sasl->external_auth = authid ? pn_strdup(authid) : NULL;
+}
+
 const char *pn_sasl_get_user(pn_sasl_t *sasl0)
 {
     pni_sasl_t *sasl = get_sasl_internal(sasl0);
@@ -476,6 +488,7 @@ void pn_sasl_free(pn_transport_t *transport)
       free(sasl->included_mechanisms);
       free(sasl->password);
       free(sasl->config_dir);
+      free(sasl->external_auth);
 
       // CYRUS_SASL
       if (sasl->impl_context) {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1cfeef1c/proton-c/src/transport/transport.c
----------------------------------------------------------------------
diff --git a/proton-c/src/transport/transport.c b/proton-c/src/transport/transport.c
index b5887ef..0e23975 100644
--- a/proton-c/src/transport/transport.c
+++ b/proton-c/src/transport/transport.c
@@ -250,6 +250,7 @@ ssize_t pn_io_layer_input_autodetect(pn_transport_t *transport, unsigned int lay
     transport->io_layers[layer+1] = &pni_autodetect_layer;
     if (transport->trace & PN_TRACE_FRM)
         pn_transport_logf(transport, "  <- %s", "SASL");
+    pni_sasl_set_external_security(transport, pn_ssl_get_ssf((pn_ssl_t*)transport), pn_ssl_get_remote_subject((pn_ssl_t*)transport));
     return 8;
   case PNI_PROTOCOL_AMQP1:
     if (transport->auth_required && !pn_transport_is_authenticated(transport)) {


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


[10/50] [abbrv] qpid-proton git commit: PROTON-896: declare functions static that are only referred to in one file, and change their names to have pni_ prefix.

Posted by kg...@apache.org.
PROTON-896: declare functions static that are only referred to in one
file, and change their names to have pni_ prefix.


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

Branch: refs/heads/kgiusti-python3
Commit: d921c6bc8a05663daa2bc0ff38e6d8808b029802
Parents: 5a6c8da
Author: Mick Goulish <mi...@redhat.com>
Authored: Mon Jun 8 10:05:50 2015 -0400
Committer: Mick Goulish <mi...@redhat.com>
Committed: Mon Jun 8 10:05:50 2015 -0400

----------------------------------------------------------------------
 proton-c/src/buffer.c                 |  56 ++++-----
 proton-c/src/codec/codec.c            | 190 ++++++++++++++---------------
 proton-c/src/codec/decoder.c          |  28 ++---
 proton-c/src/engine/engine-internal.h |   2 -
 proton-c/src/engine/engine.c          | 124 ++++++++++---------
 proton-c/src/object/list.c            |  11 +-
 proton-c/src/object/map.c             |   4 +-
 proton-c/src/parser.c                 | 119 +++++++++---------
 proton-c/src/scanner.c                |  90 +++++++-------
 proton-c/src/transport/transport.c    | 174 +++++++++++++-------------
 10 files changed, 390 insertions(+), 408 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d921c6bc/proton-c/src/buffer.c
----------------------------------------------------------------------
diff --git a/proton-c/src/buffer.c b/proton-c/src/buffer.c
index 145292a..64fa61f 100644
--- a/proton-c/src/buffer.c
+++ b/proton-c/src/buffer.c
@@ -81,12 +81,12 @@ size_t pn_buffer_available(pn_buffer_t *buf)
   return buf->capacity - buf->size;
 }
 
-size_t pn_buffer_head(pn_buffer_t *buf)
+static size_t pni_buffer_head(pn_buffer_t *buf)
 {
   return buf->start;
 }
 
-size_t pn_buffer_tail(pn_buffer_t *buf)
+static size_t pni_buffer_tail(pn_buffer_t *buf)
 {
   size_t tail = buf->start + buf->size;
   if (tail >= buf->capacity)
@@ -94,42 +94,42 @@ size_t pn_buffer_tail(pn_buffer_t *buf)
   return tail;
 }
 
-bool pn_buffer_wrapped(pn_buffer_t *buf)
+static bool pni_buffer_wrapped(pn_buffer_t *buf)
 {
-  return buf->size && pn_buffer_head(buf) >= pn_buffer_tail(buf);
+  return buf->size && pni_buffer_head(buf) >= pni_buffer_tail(buf);
 }
 
-size_t pn_buffer_tail_space(pn_buffer_t *buf)
+static size_t pni_buffer_tail_space(pn_buffer_t *buf)
 {
-  if (pn_buffer_wrapped(buf)) {
+  if (pni_buffer_wrapped(buf)) {
     return pn_buffer_available(buf);
   } else {
-    return buf->capacity - pn_buffer_tail(buf);
+    return buf->capacity - pni_buffer_tail(buf);
   }
 }
 
-size_t pn_buffer_head_space(pn_buffer_t *buf)
+static size_t pni_buffer_head_space(pn_buffer_t *buf)
 {
-  if (pn_buffer_wrapped(buf)) {
+  if (pni_buffer_wrapped(buf)) {
     return pn_buffer_available(buf);
   } else {
-    return pn_buffer_head(buf);
+    return pni_buffer_head(buf);
   }
 }
 
-size_t pn_buffer_head_size(pn_buffer_t *buf)
+static size_t pni_buffer_head_size(pn_buffer_t *buf)
 {
-  if (pn_buffer_wrapped(buf)) {
-    return buf->capacity - pn_buffer_head(buf);
+  if (pni_buffer_wrapped(buf)) {
+    return buf->capacity - pni_buffer_head(buf);
   } else {
-    return pn_buffer_tail(buf) - pn_buffer_head(buf);
+    return pni_buffer_tail(buf) - pni_buffer_head(buf);
   }
 }
 
-size_t pn_buffer_tail_size(pn_buffer_t *buf)
+static size_t pni_buffer_tail_size(pn_buffer_t *buf)
 {
-  if (pn_buffer_wrapped(buf)) {
-    return pn_buffer_tail(buf);
+  if (pni_buffer_wrapped(buf)) {
+    return pni_buffer_tail(buf);
   } else {
     return 0;
   }
@@ -138,8 +138,8 @@ size_t pn_buffer_tail_size(pn_buffer_t *buf)
 int pn_buffer_ensure(pn_buffer_t *buf, size_t size)
 {
   size_t old_capacity = buf->capacity;
-  size_t old_head = pn_buffer_head(buf);
-  bool wrapped = pn_buffer_wrapped(buf);
+  size_t old_head = pni_buffer_head(buf);
+  bool wrapped = pni_buffer_wrapped(buf);
 
   while (pn_buffer_available(buf) < size) {
     buf->capacity = 2*(buf->capacity ? buf->capacity : 16);
@@ -166,8 +166,8 @@ int pn_buffer_append(pn_buffer_t *buf, const char *bytes, size_t size)
   int err = pn_buffer_ensure(buf, size);
   if (err) return err;
 
-  size_t tail = pn_buffer_tail(buf);
-  size_t tail_space = pn_buffer_tail_space(buf);
+  size_t tail = pni_buffer_tail(buf);
+  size_t tail_space = pni_buffer_tail_space(buf);
   size_t n = pn_min(tail_space, size);
 
   memmove(buf->bytes + tail, bytes, n);
@@ -183,8 +183,8 @@ int pn_buffer_prepend(pn_buffer_t *buf, const char *bytes, size_t size)
   int err = pn_buffer_ensure(buf, size);
   if (err) return err;
 
-  size_t head = pn_buffer_head(buf);
-  size_t head_space = pn_buffer_head_space(buf);
+  size_t head = pni_buffer_head(buf);
+  size_t head_space = pni_buffer_head_space(buf);
   size_t n = pn_min(head_space, size);
 
   memmove(buf->bytes + head - n, bytes + size - n, n);
@@ -201,7 +201,7 @@ int pn_buffer_prepend(pn_buffer_t *buf, const char *bytes, size_t size)
   return 0;
 }
 
-size_t pn_buffer_index(pn_buffer_t *buf, size_t index)
+static size_t pni_buffer_index(pn_buffer_t *buf, size_t index)
 {
   size_t result = buf->start + index;
   if (result >= buf->capacity) result -= buf->capacity;
@@ -211,8 +211,8 @@ size_t pn_buffer_index(pn_buffer_t *buf, size_t index)
 size_t pn_buffer_get(pn_buffer_t *buf, size_t offset, size_t size, char *dst)
 {
   size = pn_min(size, buf->size);
-  size_t start = pn_buffer_index(buf, offset);
-  size_t stop = pn_buffer_index(buf, offset + size);
+  size_t start = pni_buffer_index(buf, offset);
+  size_t stop = pni_buffer_index(buf, offset + size);
 
   if (size == 0) return 0;
 
@@ -303,8 +303,8 @@ pn_buffer_memory_t pn_buffer_memory(pn_buffer_t *buf)
 int pn_buffer_print(pn_buffer_t *buf)
 {
   printf("pn_buffer(\"");
-  pn_print_data(buf->bytes + pn_buffer_head(buf), pn_buffer_head_size(buf));
-  pn_print_data(buf->bytes, pn_buffer_tail_size(buf));
+  pn_print_data(buf->bytes + pni_buffer_head(buf), pni_buffer_head_size(buf));
+  pn_print_data(buf->bytes, pni_buffer_tail_size(buf));
   printf("\")");
   return 0;
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d921c6bc/proton-c/src/codec/codec.c
----------------------------------------------------------------------
diff --git a/proton-c/src/codec/codec.c b/proton-c/src/codec/codec.c
index e8750fe..c00e79a 100644
--- a/proton-c/src/codec/codec.c
+++ b/proton-c/src/codec/codec.c
@@ -415,14 +415,14 @@ void pn_data_clear(pn_data_t *data)
   }
 }
 
-int pn_data_grow(pn_data_t *data)
+static int pni_data_grow(pn_data_t *data)
 {
   data->capacity = 2*(data->capacity ? data->capacity : 2);
   data->nodes = (pni_node_t *) realloc(data->nodes, data->capacity * sizeof(pni_node_t));
   return 0;
 }
 
-ssize_t pn_data_intern(pn_data_t *data, const char *start, size_t size)
+static ssize_t pni_data_intern(pn_data_t *data, const char *start, size_t size)
 {
   size_t offset = pn_buffer_size(data->buf);
   int err = pn_buffer_append(data->buf, start, size);
@@ -432,7 +432,7 @@ ssize_t pn_data_intern(pn_data_t *data, const char *start, size_t size)
   return offset;
 }
 
-pn_bytes_t *pn_data_bytes(pn_data_t *data, pni_node_t *node)
+static pn_bytes_t *pni_data_bytes(pn_data_t *data, pni_node_t *node)
 {
   switch (node->atom.type) {
   case PN_BINARY:
@@ -443,23 +443,23 @@ pn_bytes_t *pn_data_bytes(pn_data_t *data, pni_node_t *node)
   }
 }
 
-void pn_data_rebase(pn_data_t *data, char *base)
+static void pni_data_rebase(pn_data_t *data, char *base)
 {
   for (unsigned i = 0; i < data->size; i++) {
     pni_node_t *node = &data->nodes[i];
     if (node->data) {
-      pn_bytes_t *bytes = pn_data_bytes(data, node);
+      pn_bytes_t *bytes = pni_data_bytes(data, node);
       bytes->start = base + node->data_offset;
     }
   }
 }
 
-int pn_data_intern_node(pn_data_t *data, pni_node_t *node)
+static int pni_data_intern_node(pn_data_t *data, pni_node_t *node)
 {
-  pn_bytes_t *bytes = pn_data_bytes(data, node);
+  pn_bytes_t *bytes = pni_data_bytes(data, node);
   if (!bytes) return 0;
   size_t oldcap = pn_buffer_capacity(data->buf);
-  ssize_t offset = pn_data_intern(data, bytes->start, bytes->size);
+  ssize_t offset = pni_data_intern(data, bytes->start, bytes->size);
   if (offset < 0) return offset;
   node->data = true;
   node->data_offset = offset;
@@ -468,7 +468,7 @@ int pn_data_intern_node(pn_data_t *data, pni_node_t *node)
   bytes->start = buf.start + offset;
 
   if (pn_buffer_capacity(data->buf) != oldcap) {
-    pn_data_rebase(data, buf.start);
+    pni_data_rebase(data, buf.start);
   }
 
   return 0;
@@ -696,7 +696,7 @@ static bool pn_scan_next(pn_data_t *data, pn_type_t *type, bool suspend)
   }
 }
 
-pni_node_t *pn_data_peek(pn_data_t *data);
+static pni_node_t *pni_data_peek(pn_data_t *data);
 
 int pn_data_vscan(pn_data_t *data, const char *fmt, va_list ap)
 {
@@ -1037,7 +1037,7 @@ int pn_data_vscan(pn_data_t *data, const char *fmt, va_list ap)
         pn_data_t *dst = va_arg(ap, pn_data_t *);
         if (!suspend) {
           size_t old = pn_data_size(dst);
-          pni_node_t *next = pn_data_peek(data);
+          pni_node_t *next = pni_data_peek(data);
           if (next && next->atom.type != PN_NULL) {
             pn_data_narrow(data);
             int err = pn_data_appendn(dst, data, 1);
@@ -1104,23 +1104,15 @@ int pn_data_format(pn_data_t *data, char *bytes, size_t *size)
   }
 }
 
-int pn_data_resize(pn_data_t *data, size_t size)
-{
-  if (!data || size > data->capacity) return PN_ARG_ERR;
-  data->size = size;
-  return 0;
-}
-
-
-size_t pn_data_id(pn_data_t *data, pni_node_t *node)
+static size_t pni_data_id(pn_data_t *data, pni_node_t *node)
 {
   return node - data->nodes + 1;
 }
 
-pni_node_t *pn_data_new(pn_data_t *data)
+static pni_node_t *pni_data_new(pn_data_t *data)
 {
   if (data->capacity <= data->size) {
-    pn_data_grow(data);
+    pni_data_grow(data);
   }
   pni_node_t *node = pn_data_node(data, ++(data->size));
   node->next = 0;
@@ -1135,7 +1127,7 @@ void pn_data_rewind(pn_data_t *data)
   data->current = data->base_current;
 }
 
-pni_node_t *pn_data_current(pn_data_t *data)
+static pni_node_t *pni_data_current(pn_data_t *data)
 {
   return pn_data_node(data, data->current);
 }
@@ -1170,7 +1162,7 @@ bool pn_data_restore(pn_data_t *data, pn_handle_t point)
     return true;
   } else if (point && point <= data->size) {
     data->current = point;
-    pni_node_t *current = pn_data_current(data);
+    pni_node_t *current = pni_data_current(data);
     data->parent = current->parent;
     return true;
   } else {
@@ -1178,9 +1170,9 @@ bool pn_data_restore(pn_data_t *data, pn_handle_t point)
   }
 }
 
-pni_node_t *pn_data_peek(pn_data_t *data)
+static pni_node_t *pni_data_peek(pn_data_t *data)
 {
-  pni_node_t *current = pn_data_current(data);
+  pni_node_t *current = pni_data_current(data);
   if (current) {
     return pn_data_node(data, current->next);
   }
@@ -1195,7 +1187,7 @@ pni_node_t *pn_data_peek(pn_data_t *data)
 
 bool pn_data_next(pn_data_t *data)
 {
-  pni_node_t *current = pn_data_current(data);
+  pni_node_t *current = pni_data_current(data);
   pni_node_t *parent = pn_data_node(data, data->parent);
   size_t next;
 
@@ -1219,7 +1211,7 @@ bool pn_data_next(pn_data_t *data)
 
 bool pn_data_prev(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->prev) {
     data->current = node->prev;
     return true;
@@ -1270,7 +1262,7 @@ int pni_data_traverse(pn_data_t *data,
 
 pn_type_t pn_data_type(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node) {
     return node->atom.type;
   } else {
@@ -1366,9 +1358,9 @@ void pn_data_dump(pn_data_t *data)
   }
 }
 
-pni_node_t *pn_data_add(pn_data_t *data)
+static pni_node_t *pni_data_add(pn_data_t *data)
 {
-  pni_node_t *current = pn_data_current(data);
+  pni_node_t *current = pni_data_current(data);
   pni_node_t *parent = pn_data_node(data, data->parent);
   pni_node_t *node;
 
@@ -1376,16 +1368,16 @@ pni_node_t *pn_data_add(pn_data_t *data)
     if (current->next) {
       node = pn_data_node(data, current->next);
     } else {
-      node = pn_data_new(data);
+      node = pni_data_new(data);
       // refresh the pointers in case we grew
-      current = pn_data_current(data);
+      current = pni_data_current(data);
       parent = pn_data_node(data, data->parent);
       node->prev = data->current;
-      current->next = pn_data_id(data, node);
+      current->next = pni_data_id(data, node);
       node->parent = data->parent;
       if (parent) {
         if (!parent->down) {
-          parent->down = pn_data_id(data, node);
+          parent->down = pni_data_id(data, node);
         }
         parent->children++;
       }
@@ -1394,18 +1386,18 @@ pni_node_t *pn_data_add(pn_data_t *data)
     if (parent->down) {
       node = pn_data_node(data, parent->down);
     } else {
-      node = pn_data_new(data);
+      node = pni_data_new(data);
       // refresh the pointers in case we grew
       parent = pn_data_node(data, data->parent);
       node->prev = 0;
       node->parent = data->parent;
-      parent->down = pn_data_id(data, node);
+      parent->down = pni_data_id(data, node);
       parent->children++;
     }
   } else if (data->size) {
     node = pn_data_node(data, 1);
   } else {
-    node = pn_data_new(data);
+    node = pni_data_new(data);
     node->prev = 0;
     node->parent = 0;
   }
@@ -1415,7 +1407,7 @@ pni_node_t *pn_data_add(pn_data_t *data)
   node->data = false;
   node->data_offset = 0;
   node->data_size = 0;
-  data->current = pn_data_id(data, node);
+  data->current = pni_data_id(data, node);
   return node;
 }
 
@@ -1436,21 +1428,21 @@ ssize_t pn_data_decode(pn_data_t *data, const char *bytes, size_t size)
 
 int pn_data_put_list(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_LIST;
   return 0;
 }
 
 int pn_data_put_map(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_MAP;
   return 0;
 }
 
 int pn_data_put_array(pn_data_t *data, bool described, pn_type_t type)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_ARRAY;
   node->described = described;
   node->type = type;
@@ -1459,27 +1451,27 @@ int pn_data_put_array(pn_data_t *data, bool described, pn_type_t type)
 
 void pni_data_set_array_type(pn_data_t *data, pn_type_t type)
 {
-  pni_node_t *array = pn_data_current(data);
+  pni_node_t *array = pni_data_current(data);
   if (array) array->type = type;
 }
 
 int pn_data_put_described(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_DESCRIBED;
   return 0;
 }
 
 int pn_data_put_null(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   pni_atom_init(&node->atom, PN_NULL);
   return 0;
 }
 
 int pn_data_put_bool(pn_data_t *data, bool b)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_BOOL;
   node->atom.u.as_bool = b;
   return 0;
@@ -1487,7 +1479,7 @@ int pn_data_put_bool(pn_data_t *data, bool b)
 
 int pn_data_put_ubyte(pn_data_t *data, uint8_t ub)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_UBYTE;
   node->atom.u.as_ubyte = ub;
   return 0;
@@ -1495,7 +1487,7 @@ int pn_data_put_ubyte(pn_data_t *data, uint8_t ub)
 
 int pn_data_put_byte(pn_data_t *data, int8_t b)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_BYTE;
   node->atom.u.as_byte = b;
   return 0;
@@ -1503,7 +1495,7 @@ int pn_data_put_byte(pn_data_t *data, int8_t b)
 
 int pn_data_put_ushort(pn_data_t *data, uint16_t us)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_USHORT;
   node->atom.u.as_ushort = us;
   return 0;
@@ -1511,7 +1503,7 @@ int pn_data_put_ushort(pn_data_t *data, uint16_t us)
 
 int pn_data_put_short(pn_data_t *data, int16_t s)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_SHORT;
   node->atom.u.as_short = s;
   return 0;
@@ -1519,7 +1511,7 @@ int pn_data_put_short(pn_data_t *data, int16_t s)
 
 int pn_data_put_uint(pn_data_t *data, uint32_t ui)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_UINT;
   node->atom.u.as_uint = ui;
   return 0;
@@ -1527,7 +1519,7 @@ int pn_data_put_uint(pn_data_t *data, uint32_t ui)
 
 int pn_data_put_int(pn_data_t *data, int32_t i)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_INT;
   node->atom.u.as_int = i;
   return 0;
@@ -1535,7 +1527,7 @@ int pn_data_put_int(pn_data_t *data, int32_t i)
 
 int pn_data_put_char(pn_data_t *data, pn_char_t c)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_CHAR;
   node->atom.u.as_char = c;
   return 0;
@@ -1543,7 +1535,7 @@ int pn_data_put_char(pn_data_t *data, pn_char_t c)
 
 int pn_data_put_ulong(pn_data_t *data, uint64_t ul)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_ULONG;
   node->atom.u.as_ulong = ul;
   return 0;
@@ -1551,7 +1543,7 @@ int pn_data_put_ulong(pn_data_t *data, uint64_t ul)
 
 int pn_data_put_long(pn_data_t *data, int64_t l)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_LONG;
   node->atom.u.as_long = l;
   return 0;
@@ -1559,7 +1551,7 @@ int pn_data_put_long(pn_data_t *data, int64_t l)
 
 int pn_data_put_timestamp(pn_data_t *data, pn_timestamp_t t)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_TIMESTAMP;
   node->atom.u.as_timestamp = t;
   return 0;
@@ -1567,7 +1559,7 @@ int pn_data_put_timestamp(pn_data_t *data, pn_timestamp_t t)
 
 int pn_data_put_float(pn_data_t *data, float f)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_FLOAT;
   node->atom.u.as_float = f;
   return 0;
@@ -1575,7 +1567,7 @@ int pn_data_put_float(pn_data_t *data, float f)
 
 int pn_data_put_double(pn_data_t *data, double d)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_DOUBLE;
   node->atom.u.as_double = d;
   return 0;
@@ -1583,7 +1575,7 @@ int pn_data_put_double(pn_data_t *data, double d)
 
 int pn_data_put_decimal32(pn_data_t *data, pn_decimal32_t d)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_DECIMAL32;
   node->atom.u.as_decimal32 = d;
   return 0;
@@ -1591,7 +1583,7 @@ int pn_data_put_decimal32(pn_data_t *data, pn_decimal32_t d)
 
 int pn_data_put_decimal64(pn_data_t *data, pn_decimal64_t d)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_DECIMAL64;
   node->atom.u.as_decimal64 = d;
   return 0;
@@ -1599,7 +1591,7 @@ int pn_data_put_decimal64(pn_data_t *data, pn_decimal64_t d)
 
 int pn_data_put_decimal128(pn_data_t *data, pn_decimal128_t d)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_DECIMAL128;
   memmove(node->atom.u.as_decimal128.bytes, d.bytes, 16);
   return 0;
@@ -1607,7 +1599,7 @@ int pn_data_put_decimal128(pn_data_t *data, pn_decimal128_t d)
 
 int pn_data_put_uuid(pn_data_t *data, pn_uuid_t u)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_UUID;
   memmove(node->atom.u.as_uuid.bytes, u.bytes, 16);
   return 0;
@@ -1615,38 +1607,38 @@ int pn_data_put_uuid(pn_data_t *data, pn_uuid_t u)
 
 int pn_data_put_binary(pn_data_t *data, pn_bytes_t bytes)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_BINARY;
   node->atom.u.as_bytes = bytes;
-  return pn_data_intern_node(data, node);
+  return pni_data_intern_node(data, node);
 }
 
 int pn_data_put_string(pn_data_t *data, pn_bytes_t string)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_STRING;
   node->atom.u.as_bytes = string;
-  return pn_data_intern_node(data, node);
+  return pni_data_intern_node(data, node);
 }
 
 int pn_data_put_symbol(pn_data_t *data, pn_bytes_t symbol)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom.type = PN_SYMBOL;
   node->atom.u.as_bytes = symbol;
-  return pn_data_intern_node(data, node);
+  return pni_data_intern_node(data, node);
 }
 
 int pn_data_put_atom(pn_data_t *data, pn_atom_t atom)
 {
-  pni_node_t *node = pn_data_add(data);
+  pni_node_t *node = pni_data_add(data);
   node->atom = atom;
-  return pn_data_intern_node(data, node);
+  return pni_data_intern_node(data, node);
 }
 
 size_t pn_data_get_list(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_LIST) {
     return node->children;
   } else {
@@ -1656,7 +1648,7 @@ size_t pn_data_get_list(pn_data_t *data)
 
 size_t pn_data_get_map(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_MAP) {
     return node->children;
   } else {
@@ -1666,7 +1658,7 @@ size_t pn_data_get_map(pn_data_t *data)
 
 size_t pn_data_get_array(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_ARRAY) {
     if (node->described) {
       return node->children - 1;
@@ -1680,7 +1672,7 @@ size_t pn_data_get_array(pn_data_t *data)
 
 bool pn_data_is_array_described(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_ARRAY) {
     return node->described;
   } else {
@@ -1690,7 +1682,7 @@ bool pn_data_is_array_described(pn_data_t *data)
 
 pn_type_t pn_data_get_array_type(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_ARRAY) {
     return node->type;
   } else {
@@ -1700,19 +1692,19 @@ pn_type_t pn_data_get_array_type(pn_data_t *data)
 
 bool pn_data_is_described(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   return node && node->atom.type == PN_DESCRIBED;
 }
 
 bool pn_data_is_null(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   return node && node->atom.type == PN_NULL;
 }
 
 bool pn_data_get_bool(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_BOOL) {
     return node->atom.u.as_bool;
   } else {
@@ -1722,7 +1714,7 @@ bool pn_data_get_bool(pn_data_t *data)
 
 uint8_t pn_data_get_ubyte(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_UBYTE) {
     return node->atom.u.as_ubyte;
   } else {
@@ -1732,7 +1724,7 @@ uint8_t pn_data_get_ubyte(pn_data_t *data)
 
 int8_t pn_data_get_byte(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_BYTE) {
     return node->atom.u.as_byte;
   } else {
@@ -1742,7 +1734,7 @@ int8_t pn_data_get_byte(pn_data_t *data)
 
 uint16_t pn_data_get_ushort(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_USHORT) {
     return node->atom.u.as_ushort;
   } else {
@@ -1752,7 +1744,7 @@ uint16_t pn_data_get_ushort(pn_data_t *data)
 
 int16_t pn_data_get_short(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_SHORT) {
     return node->atom.u.as_short;
   } else {
@@ -1762,7 +1754,7 @@ int16_t pn_data_get_short(pn_data_t *data)
 
 uint32_t pn_data_get_uint(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_UINT) {
     return node->atom.u.as_uint;
   } else {
@@ -1772,7 +1764,7 @@ uint32_t pn_data_get_uint(pn_data_t *data)
 
 int32_t pn_data_get_int(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_INT) {
     return node->atom.u.as_int;
   } else {
@@ -1782,7 +1774,7 @@ int32_t pn_data_get_int(pn_data_t *data)
 
 pn_char_t pn_data_get_char(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_CHAR) {
     return node->atom.u.as_char;
   } else {
@@ -1792,7 +1784,7 @@ pn_char_t pn_data_get_char(pn_data_t *data)
 
 uint64_t pn_data_get_ulong(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_ULONG) {
     return node->atom.u.as_ulong;
   } else {
@@ -1802,7 +1794,7 @@ uint64_t pn_data_get_ulong(pn_data_t *data)
 
 int64_t pn_data_get_long(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_LONG) {
     return node->atom.u.as_long;
   } else {
@@ -1812,7 +1804,7 @@ int64_t pn_data_get_long(pn_data_t *data)
 
 pn_timestamp_t pn_data_get_timestamp(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_TIMESTAMP) {
     return node->atom.u.as_timestamp;
   } else {
@@ -1822,7 +1814,7 @@ pn_timestamp_t pn_data_get_timestamp(pn_data_t *data)
 
 float pn_data_get_float(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_FLOAT) {
     return node->atom.u.as_float;
   } else {
@@ -1832,7 +1824,7 @@ float pn_data_get_float(pn_data_t *data)
 
 double pn_data_get_double(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_DOUBLE) {
     return node->atom.u.as_double;
   } else {
@@ -1842,7 +1834,7 @@ double pn_data_get_double(pn_data_t *data)
 
 pn_decimal32_t pn_data_get_decimal32(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_DECIMAL32) {
     return node->atom.u.as_decimal32;
   } else {
@@ -1852,7 +1844,7 @@ pn_decimal32_t pn_data_get_decimal32(pn_data_t *data)
 
 pn_decimal64_t pn_data_get_decimal64(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_DECIMAL64) {
     return node->atom.u.as_decimal64;
   } else {
@@ -1862,7 +1854,7 @@ pn_decimal64_t pn_data_get_decimal64(pn_data_t *data)
 
 pn_decimal128_t pn_data_get_decimal128(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_DECIMAL128) {
     return node->atom.u.as_decimal128;
   } else {
@@ -1873,7 +1865,7 @@ pn_decimal128_t pn_data_get_decimal128(pn_data_t *data)
 
 pn_uuid_t pn_data_get_uuid(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_UUID) {
     return node->atom.u.as_uuid;
   } else {
@@ -1884,7 +1876,7 @@ pn_uuid_t pn_data_get_uuid(pn_data_t *data)
 
 pn_bytes_t pn_data_get_binary(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_BINARY) {
     return node->atom.u.as_bytes;
   } else {
@@ -1895,7 +1887,7 @@ pn_bytes_t pn_data_get_binary(pn_data_t *data)
 
 pn_bytes_t pn_data_get_string(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_STRING) {
     return node->atom.u.as_bytes;
   } else {
@@ -1906,7 +1898,7 @@ pn_bytes_t pn_data_get_string(pn_data_t *data)
 
 pn_bytes_t pn_data_get_symbol(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && node->atom.type == PN_SYMBOL) {
     return node->atom.u.as_bytes;
   } else {
@@ -1917,7 +1909,7 @@ pn_bytes_t pn_data_get_symbol(pn_data_t *data)
 
 pn_bytes_t pn_data_get_bytes(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node && (node->atom.type == PN_BINARY ||
                node->atom.type == PN_STRING ||
                node->atom.type == PN_SYMBOL)) {
@@ -1930,7 +1922,7 @@ pn_bytes_t pn_data_get_bytes(pn_data_t *data)
 
 pn_atom_t pn_data_get_atom(pn_data_t *data)
 {
-  pni_node_t *node = pn_data_current(data);
+  pni_node_t *node = pni_data_current(data);
   if (node) {
     return *((pn_atom_t *) &node->atom);
   } else {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d921c6bc/proton-c/src/codec/decoder.c
----------------------------------------------------------------------
diff --git a/proton-c/src/codec/decoder.c b/proton-c/src/codec/decoder.c
index dbbb13f..b0c8d79 100644
--- a/proton-c/src/codec/decoder.c
+++ b/proton-c/src/codec/decoder.c
@@ -189,11 +189,11 @@ static inline pn_type_t pn_code2type(uint8_t code)
   }
 }
 
-int pn_decoder_decode_type(pn_decoder_t *decoder, pn_data_t *data, uint8_t *code);
-int pn_decoder_single(pn_decoder_t *decoder, pn_data_t *data);
+static int pni_decoder_decode_type(pn_decoder_t *decoder, pn_data_t *data, uint8_t *code);
+static int pni_decoder_single(pn_decoder_t *decoder, pn_data_t *data);
 void pni_data_set_array_type(pn_data_t *data, pn_type_t type);
 
-int pn_decoder_decode_value(pn_decoder_t *decoder, pn_data_t *data, uint8_t code)
+static int pni_decoder_decode_value(pn_decoder_t *decoder, pn_data_t *data, uint8_t code)
 {
   int err;
   conv_t conv;
@@ -392,13 +392,13 @@ int pn_decoder_decode_value(pn_decoder_t *decoder, pn_data_t *data, uint8_t code
 
         pn_data_enter(data);
         uint8_t acode;
-        int e = pn_decoder_decode_type(decoder, data, &acode);
+        int e = pni_decoder_decode_type(decoder, data, &acode);
         if (e) return e;
         pn_type_t type = pn_code2type(acode);
         if ((int)type < 0) return (int)type;
         for (size_t i = 0; i < count; i++)
         {
-          e = pn_decoder_decode_value(decoder, data, acode);
+          e = pni_decoder_decode_value(decoder, data, acode);
           if (e) return e;
         }
         pn_data_exit(data);
@@ -423,7 +423,7 @@ int pn_decoder_decode_value(pn_decoder_t *decoder, pn_data_t *data, uint8_t code
     pn_data_enter(data);
     for (size_t i = 0; i < count; i++)
     {
-      int e = pn_decoder_single(decoder, data);
+      int e = pni_decoder_single(decoder, data);
       if (e) return e;
     }
     pn_data_exit(data);
@@ -438,7 +438,7 @@ int pn_decoder_decode_value(pn_decoder_t *decoder, pn_data_t *data, uint8_t code
 
 pn_type_t pni_data_parent_type(pn_data_t *data);
 
-int pn_decoder_decode_type(pn_decoder_t *decoder, pn_data_t *data, uint8_t *code)
+static int pni_decoder_decode_type(pn_decoder_t *decoder, pn_data_t *data, uint8_t *code)
 {
   int err;
 
@@ -452,12 +452,12 @@ int pn_decoder_decode_type(pn_decoder_t *decoder, pn_data_t *data, uint8_t *code
     if (pni_data_parent_type(data) != PN_ARRAY) {
       err = pn_data_put_described(data);
       if (err) return err;
-      // pn_decoder_single has the corresponding exit
+      // pni_decoder_single has the corresponding exit
       pn_data_enter(data);
     }
-    err = pn_decoder_single(decoder, data);
+    err = pni_decoder_single(decoder, data);
     if (err) return err;
-    err = pn_decoder_decode_type(decoder, data, code);
+    err = pni_decoder_decode_type(decoder, data, code);
     if (err) return err;
   } else {
     *code = next;
@@ -468,12 +468,12 @@ int pn_decoder_decode_type(pn_decoder_t *decoder, pn_data_t *data, uint8_t *code
 
 size_t pn_data_siblings(pn_data_t *data);
 
-int pn_decoder_single(pn_decoder_t *decoder, pn_data_t *data)
+int pni_decoder_single(pn_decoder_t *decoder, pn_data_t *data)
 {
   uint8_t code;
-  int err = pn_decoder_decode_type(decoder, data, &code);
+  int err = pni_decoder_decode_type(decoder, data, &code);
   if (err) return err;
-  err = pn_decoder_decode_value(decoder, data, code);
+  err = pni_decoder_decode_value(decoder, data, code);
   if (err) return err;
   if (pni_data_parent_type(data) == PN_DESCRIBED && pn_data_siblings(data) > 1) {
     pn_data_exit(data);
@@ -487,7 +487,7 @@ ssize_t pn_decoder_decode(pn_decoder_t *decoder, const char *src, size_t size, p
   decoder->size = size;
   decoder->position = src;
 
-  int err = pn_decoder_single(decoder, dst);
+  int err = pni_decoder_single(decoder, dst);
 
   if (err == PN_UNDERFLOW) 
       return pn_error_format(pn_data_error(dst), PN_UNDERFLOW, "not enough data to decode");

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d921c6bc/proton-c/src/engine/engine-internal.h
----------------------------------------------------------------------
diff --git a/proton-c/src/engine/engine-internal.h b/proton-c/src/engine/engine-internal.h
index 2f0cc56..4c72310 100644
--- a/proton-c/src/engine/engine-internal.h
+++ b/proton-c/src/engine/engine-internal.h
@@ -334,9 +334,7 @@ void pn_connection_bound(pn_connection_t *conn);
 void pn_connection_unbound(pn_connection_t *conn);
 int pn_do_error(pn_transport_t *transport, const char *condition, const char *fmt, ...);
 void pn_set_error_layer(pn_transport_t *transport);
-void pn_session_bound(pn_session_t* ssn);
 void pn_session_unbound(pn_session_t* ssn);
-void pn_link_bound(pn_link_t* link);
 void pn_link_unbound(pn_link_t* link);
 void pn_ep_incref(pn_endpoint_t *endpoint);
 void pn_ep_decref(pn_endpoint_t *endpoint);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d921c6bc/proton-c/src/engine/engine.c
----------------------------------------------------------------------
diff --git a/proton-c/src/engine/engine.c b/proton-c/src/engine/engine.c
index 67cc882..c5228a5 100644
--- a/proton-c/src/engine/engine.c
+++ b/proton-c/src/engine/engine.c
@@ -32,9 +32,14 @@
 #include "platform_fmt.h"
 #include "transport/transport.h"
 
+
+static void pni_session_bound(pn_session_t *ssn);
+static void pni_link_bound(pn_link_t *link);
+
+
 // endpoints
 
-pn_connection_t *pn_ep_get_connection(pn_endpoint_t *endpoint)
+static pn_connection_t *pni_ep_get_connection(pn_endpoint_t *endpoint)
 {
   switch (endpoint->type) {
   case CONNECTION:
@@ -68,7 +73,7 @@ static void pn_endpoint_open(pn_endpoint_t *endpoint)
 {
   if (!(endpoint->state & PN_LOCAL_ACTIVE)) {
     PN_SET_LOCAL(endpoint->state, PN_LOCAL_ACTIVE);
-    pn_connection_t *conn = pn_ep_get_connection(endpoint);
+    pn_connection_t *conn = pni_ep_get_connection(endpoint);
     pn_collector_put(conn->collector, PN_OBJECT, endpoint,
                      endpoint_event(endpoint->type, true));
     pn_modified(conn, endpoint, true);
@@ -79,7 +84,7 @@ static void pn_endpoint_close(pn_endpoint_t *endpoint)
 {
   if (!(endpoint->state & PN_LOCAL_CLOSED)) {
     PN_SET_LOCAL(endpoint->state, PN_LOCAL_CLOSED);
-    pn_connection_t *conn = pn_ep_get_connection(endpoint);
+    pn_connection_t *conn = pni_ep_get_connection(endpoint);
     pn_collector_put(conn->collector, PN_OBJECT, endpoint,
                      endpoint_event(endpoint->type, false));
     pn_modified(conn, endpoint, true);
@@ -105,7 +110,7 @@ void pn_connection_close(pn_connection_t *connection)
   pn_endpoint_close(&connection->endpoint);
 }
 
-void pn_endpoint_tini(pn_endpoint_t *endpoint);
+static void pni_endpoint_tini(pn_endpoint_t *endpoint);
 
 void pn_connection_release(pn_connection_t *connection)
 {
@@ -149,7 +154,7 @@ void pn_connection_bound(pn_connection_t *connection)
 
   size_t nsessions = pn_list_size(connection->sessions);
   for (size_t i = 0; i < nsessions; i++) {
-    pn_session_bound((pn_session_t *) pn_list_get(connection->sessions, i));
+    pni_session_bound((pn_session_t *) pn_list_get(connection->sessions, i));
   }
 }
 
@@ -210,7 +215,7 @@ void pn_condition_tini(pn_condition_t *condition)
   pn_free(condition->name);
 }
 
-void pn_add_session(pn_connection_t *conn, pn_session_t *ssn)
+static void pni_add_session(pn_connection_t *conn, pn_session_t *ssn)
 {
   pn_list_add(conn->sessions, ssn);
   ssn->connection = conn;
@@ -218,7 +223,7 @@ void pn_add_session(pn_connection_t *conn, pn_session_t *ssn)
   pn_ep_incref(&conn->endpoint);
 }
 
-void pn_remove_session(pn_connection_t *conn, pn_session_t *ssn)
+static void pni_remove_session(pn_connection_t *conn, pn_session_t *ssn)
 {
   if (pn_list_remove(conn->sessions, ssn)) {
     pn_ep_decref(&conn->endpoint);
@@ -251,7 +256,7 @@ void pn_session_free(pn_session_t *session)
     pn_link_t *link = (pn_link_t *)pn_list_get(session->links, 0);
     pn_link_free(link);
   }
-  pn_remove_session(session->connection, session);
+  pni_remove_session(session->connection, session);
   pn_list_add(session->connection->freed, session);
   session->endpoint.freed = true;
   pn_ep_decref(&session->endpoint);
@@ -280,14 +285,14 @@ void pn_session_set_context(pn_session_t *session, void *context)
 }
 
 
-void pn_add_link(pn_session_t *ssn, pn_link_t *link)
+static void pni_add_link(pn_session_t *ssn, pn_link_t *link)
 {
   pn_list_add(ssn->links, link);
   link->session = ssn;
   pn_ep_incref(&ssn->endpoint);
 }
 
-void pn_remove_link(pn_session_t *ssn, pn_link_t *link)
+static void pni_remove_link(pn_session_t *ssn, pn_link_t *link)
 {
   if (pn_list_remove(ssn->links, link)) {
     pn_ep_decref(&ssn->endpoint);
@@ -316,7 +321,7 @@ void pn_link_detach(pn_link_t *link)
 
 }
 
-void pn_terminus_free(pn_terminus_t *terminus)
+static void pni_terminus_free(pn_terminus_t *terminus)
 {
   pn_free(terminus->address);
   pn_free(terminus->properties);
@@ -328,7 +333,7 @@ void pn_terminus_free(pn_terminus_t *terminus)
 void pn_link_free(pn_link_t *link)
 {
   assert(!link->endpoint.freed);
-  pn_remove_link(link->session, link);
+  pni_remove_link(link->session, link);
   pn_list_add(link->session->freed, link);
   pn_delivery_t *delivery = link->unsettled_head;
   while (delivery) {
@@ -423,12 +428,12 @@ void pn_ep_decref(pn_endpoint_t *endpoint)
   assert(endpoint->refcount > 0);
   endpoint->refcount--;
   if (endpoint->refcount == 0) {
-    pn_connection_t *conn = pn_ep_get_connection(endpoint);
+    pn_connection_t *conn = pni_ep_get_connection(endpoint);
     pn_collector_put(conn->collector, PN_OBJECT, endpoint, pn_final_type(endpoint->type));
   }
 }
 
-void pn_endpoint_tini(pn_endpoint_t *endpoint)
+static void pni_endpoint_tini(pn_endpoint_t *endpoint)
 {
   pn_error_free(endpoint->error);
   pn_condition_tini(&endpoint->remote_condition);
@@ -479,7 +484,7 @@ static void pn_connection_finalize(void *object)
   pn_free(conn->offered_capabilities);
   pn_free(conn->desired_capabilities);
   pn_free(conn->properties);
-  pn_endpoint_tini(endpoint);
+  pni_endpoint_tini(endpoint);
   pn_free(conn->delivery_pool);
 }
 
@@ -654,7 +659,7 @@ pn_delivery_t *pn_work_next(pn_delivery_t *delivery)
     return pn_work_head(delivery->link->session->connection);
 }
 
-void pn_add_work(pn_connection_t *connection, pn_delivery_t *delivery)
+static void pni_add_work(pn_connection_t *connection, pn_delivery_t *delivery)
 {
   if (!delivery->work)
   {
@@ -664,7 +669,7 @@ void pn_add_work(pn_connection_t *connection, pn_delivery_t *delivery)
   }
 }
 
-void pn_clear_work(pn_connection_t *connection, pn_delivery_t *delivery)
+static void pni_clear_work(pn_connection_t *connection, pn_delivery_t *delivery)
 {
   if (delivery->work)
   {
@@ -678,23 +683,23 @@ void pn_work_update(pn_connection_t *connection, pn_delivery_t *delivery)
   pn_link_t *link = pn_delivery_link(delivery);
   pn_delivery_t *current = pn_link_current(link);
   if (delivery->updated && !delivery->local.settled) {
-    pn_add_work(connection, delivery);
+    pni_add_work(connection, delivery);
   } else if (delivery == current) {
     if (link->endpoint.type == SENDER) {
       if (pn_link_credit(link) > 0) {
-        pn_add_work(connection, delivery);
+        pni_add_work(connection, delivery);
       } else {
-        pn_clear_work(connection, delivery);
+        pni_clear_work(connection, delivery);
       }
     } else {
-      pn_add_work(connection, delivery);
+      pni_add_work(connection, delivery);
     }
   } else {
-    pn_clear_work(connection, delivery);
+    pni_clear_work(connection, delivery);
   }
 }
 
-void pn_add_tpwork(pn_delivery_t *delivery)
+static void pni_add_tpwork(pn_delivery_t *delivery)
 {
   pn_connection_t *connection = delivery->link->session->connection;
   if (!delivery->tpwork)
@@ -755,7 +760,7 @@ void pn_clear_modified(pn_connection_t *connection, pn_endpoint_t *endpoint)
   }
 }
 
-bool pn_matches(pn_endpoint_t *endpoint, pn_endpoint_type_t type, pn_state_t state)
+static bool pni_matches(pn_endpoint_t *endpoint, pn_endpoint_type_t type, pn_state_t state)
 {
   if (endpoint->type != type) return false;
 
@@ -772,7 +777,7 @@ pn_endpoint_t *pn_find(pn_endpoint_t *endpoint, pn_endpoint_type_t type, pn_stat
 {
   while (endpoint)
   {
-    if (pn_matches(endpoint, type, state))
+    if (pni_matches(endpoint, type, state))
       return endpoint;
     endpoint = endpoint->endpoint_next;
   }
@@ -803,7 +808,7 @@ pn_link_t *pn_link_head(pn_connection_t *conn, pn_state_t state)
 
   while (endpoint)
   {
-    if (pn_matches(endpoint, SENDER, state) || pn_matches(endpoint, RECEIVER, state))
+    if (pni_matches(endpoint, SENDER, state) || pni_matches(endpoint, RECEIVER, state))
       return (pn_link_t *) endpoint;
     endpoint = endpoint->endpoint_next;
   }
@@ -819,7 +824,7 @@ pn_link_t *pn_link_next(pn_link_t *link, pn_state_t state)
 
   while (endpoint)
   {
-    if (pn_matches(endpoint, SENDER, state) || pn_matches(endpoint, RECEIVER, state))
+    if (pni_matches(endpoint, SENDER, state) || pni_matches(endpoint, RECEIVER, state))
       return (pn_link_t *) endpoint;
     endpoint = endpoint->endpoint_next;
   }
@@ -840,7 +845,7 @@ static void pn_session_incref(void *object)
 
 static bool pn_ep_bound(pn_endpoint_t *endpoint)
 {
-  pn_connection_t *conn = pn_ep_get_connection(endpoint);
+  pn_connection_t *conn = pni_ep_get_connection(endpoint);
   pn_session_t *ssn;
   pn_link_t *lnk;
 
@@ -892,7 +897,7 @@ static bool pni_endpoint_live(pn_endpoint_t *endpoint) {
 
 static bool pni_preserve_child(pn_endpoint_t *endpoint)
 {
-  pn_connection_t *conn = pn_ep_get_connection(endpoint);
+  pn_connection_t *conn = pni_ep_get_connection(endpoint);
   pn_endpoint_t *parent = pn_ep_parent(endpoint);
   if (pni_endpoint_live(parent) && (!endpoint->freed || (pn_ep_bound(endpoint)))
       && endpoint->referenced) {
@@ -917,12 +922,12 @@ static void pn_session_finalize(void *object)
 
   pn_free(session->context);
   pni_free_children(session->links, session->freed);
-  pn_endpoint_tini(endpoint);
+  pni_endpoint_tini(endpoint);
   pn_delivery_map_free(&session->state.incoming);
   pn_delivery_map_free(&session->state.outgoing);
   pn_free(session->state.local_handles);
   pn_free(session->state.remote_handles);
-  pn_remove_session(session->connection, session);
+  pni_remove_session(session->connection, session);
   pn_list_remove(session->connection->freed, session);
 
   if (session->connection->transport) {
@@ -955,7 +960,7 @@ pn_session_t *pn_session(pn_connection_t *conn)
   if (!ssn) return NULL;
 
   pn_endpoint_init(&ssn->endpoint, SESSION, conn);
-  pn_add_session(conn, ssn);
+  pni_add_session(conn, ssn);
   ssn->links = pn_list(PN_WEAKREF, 0);
   ssn->freed = pn_list(PN_WEAKREF, 0);
   ssn->context = pn_record();
@@ -977,18 +982,18 @@ pn_session_t *pn_session(pn_connection_t *conn)
 
   pn_collector_put(conn->collector, PN_OBJECT, ssn, PN_SESSION_INIT);
   if (conn->transport) {
-    pn_session_bound(ssn);
+    pni_session_bound(ssn);
   }
   pn_decref(ssn);
   return ssn;
 }
 
-void pn_session_bound(pn_session_t *ssn)
+static void pni_session_bound(pn_session_t *ssn)
 {
   assert(ssn);
   size_t nlinks = pn_list_size(ssn->links);
   for (size_t i = 0; i < nlinks; i++) {
-    pn_link_bound((pn_link_t *) pn_list_get(ssn->links, i));
+    pni_link_bound((pn_link_t *) pn_list_get(ssn->links, i));
   }
 }
 
@@ -1038,7 +1043,7 @@ pn_error_t *pn_session_error(pn_session_t *session)
   return session->endpoint.error;
 }
 
-void pn_terminus_init(pn_terminus_t *terminus, pn_terminus_type_t type)
+static void pni_terminus_init(pn_terminus_t *terminus, pn_terminus_type_t type)
 {
   terminus->type = type;
   terminus->address = pn_string(NULL);
@@ -1079,13 +1084,13 @@ static void pn_link_finalize(void *object)
   }
 
   pn_free(link->context);
-  pn_terminus_free(&link->source);
-  pn_terminus_free(&link->target);
-  pn_terminus_free(&link->remote_source);
-  pn_terminus_free(&link->remote_target);
+  pni_terminus_free(&link->source);
+  pni_terminus_free(&link->target);
+  pni_terminus_free(&link->remote_source);
+  pni_terminus_free(&link->remote_target);
   pn_free(link->name);
-  pn_endpoint_tini(endpoint);
-  pn_remove_link(link->session, link);
+  pni_endpoint_tini(endpoint);
+  pni_remove_link(link->session, link);
   pn_hash_del(link->session->state.local_handles, link->state.local_handle);
   pn_hash_del(link->session->state.remote_handles, link->state.remote_handle);
   pn_list_remove(link->session->freed, link);
@@ -1112,13 +1117,13 @@ pn_link_t *pn_link_new(int type, pn_session_t *session, const char *name)
   pn_link_t *link = (pn_link_t *) pn_class_new(&clazz, sizeof(pn_link_t));
 
   pn_endpoint_init(&link->endpoint, type, session->connection);
-  pn_add_link(session, link);
+  pni_add_link(session, link);
   pn_incref(session);  // keep session until link finalized
   link->name = pn_string(name);
-  pn_terminus_init(&link->source, PN_SOURCE);
-  pn_terminus_init(&link->target, PN_TARGET);
-  pn_terminus_init(&link->remote_source, PN_UNSPECIFIED);
-  pn_terminus_init(&link->remote_target, PN_UNSPECIFIED);
+  pni_terminus_init(&link->source, PN_SOURCE);
+  pni_terminus_init(&link->target, PN_TARGET);
+  pni_terminus_init(&link->remote_source, PN_UNSPECIFIED);
+  pni_terminus_init(&link->remote_target, PN_UNSPECIFIED);
   link->unsettled_head = link->unsettled_tail = link->current = NULL;
   link->unsettled_count = 0;
   link->available = 0;
@@ -1143,15 +1148,14 @@ pn_link_t *pn_link_new(int type, pn_session_t *session, const char *name)
 
   pn_collector_put(session->connection->collector, PN_OBJECT, link, PN_LINK_INIT);
   if (session->connection->transport) {
-    pn_link_bound(link);
+    pni_link_bound(link);
   }
   pn_decref(link);
   return link;
 }
 
-void pn_link_bound(pn_link_t *link)
+static void pni_link_bound(pn_link_t *link)
 {
-  
 }
 
 void pn_link_unbound(pn_link_t* link)
@@ -1678,17 +1682,17 @@ pn_delivery_t *pn_link_current(pn_link_t *link)
   return link->current;
 }
 
-void pn_advance_sender(pn_link_t *link)
+static void pni_advance_sender(pn_link_t *link)
 {
   link->current->done = true;
   link->queued++;
   link->credit--;
   link->session->outgoing_deliveries++;
-  pn_add_tpwork(link->current);
+  pni_add_tpwork(link->current);
   link->current = link->current->unsettled_next;
 }
 
-void pn_advance_receiver(pn_link_t *link)
+static void pni_advance_receiver(pn_link_t *link)
 {
   link->credit--;
   link->queued--;
@@ -1699,7 +1703,7 @@ void pn_advance_receiver(pn_link_t *link)
   pn_buffer_clear(current->bytes);
 
   if (!link->session->state.incoming_window) {
-    pn_add_tpwork(current);
+    pni_add_tpwork(current);
   }
 
   link->current = link->current->unsettled_next;
@@ -1710,9 +1714,9 @@ bool pn_link_advance(pn_link_t *link)
   if (link && link->current) {
     pn_delivery_t *prev = link->current;
     if (link->endpoint.type == SENDER) {
-      pn_advance_sender(link);
+      pni_advance_sender(link);
     } else {
-      pn_advance_receiver(link);
+      pni_advance_receiver(link);
     }
     pn_delivery_t *next = link->current;
     pn_work_update(link->session->connection, prev);
@@ -1795,7 +1799,7 @@ void pn_delivery_settle(pn_delivery_t *delivery)
 
     link->unsettled_count--;
     delivery->local.settled = true;
-    pn_add_tpwork(delivery);
+    pni_add_tpwork(delivery);
     pn_work_update(delivery->link->session->connection, delivery);
     pn_incref(delivery);
     pn_decref(delivery);
@@ -1814,7 +1818,7 @@ ssize_t pn_link_send(pn_link_t *sender, const char *bytes, size_t n)
   if (!bytes || !n) return 0;
   pn_buffer_append(current->bytes, bytes, n);
   sender->session->outgoing_bytes += n;
-  pn_add_tpwork(current);
+  pni_add_tpwork(current);
   return n;
 }
 
@@ -1849,7 +1853,7 @@ ssize_t pn_link_recv(pn_link_t *receiver, char *bytes, size_t n)
     if (size) {
       receiver->session->incoming_bytes -= size;
       if (!receiver->session->state.incoming_window) {
-        pn_add_tpwork(delivery);
+        pni_add_tpwork(delivery);
       }
       return size;
     } else {
@@ -1947,7 +1951,7 @@ void pn_delivery_update(pn_delivery_t *delivery, uint64_t state)
 {
   if (!delivery) return;
   delivery->local.type = state;
-  pn_add_tpwork(delivery);
+  pni_add_tpwork(delivery);
 }
 
 bool pn_delivery_writable(pn_delivery_t *delivery)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d921c6bc/proton-c/src/object/list.c
----------------------------------------------------------------------
diff --git a/proton-c/src/object/list.c b/proton-c/src/object/list.c
index 14231f6..76c70d2 100644
--- a/proton-c/src/object/list.c
+++ b/proton-c/src/object/list.c
@@ -51,7 +51,7 @@ void pn_list_set(pn_list_t *list, int index, void *value)
   pn_class_incref(list->clazz, value);
 }
 
-void pn_list_ensure(pn_list_t *list, size_t capacity)
+static void pni_list_ensure(pn_list_t *list, size_t capacity)
 {
   assert(list);
   if (list->capacity < capacity) {
@@ -66,7 +66,7 @@ void pn_list_ensure(pn_list_t *list, size_t capacity)
 int pn_list_add(pn_list_t *list, void *value)
 {
   assert(list);
-  pn_list_ensure(list, list->size + 1);
+  pni_list_ensure(list, list->size + 1);
   list->elements[list->size++] = value;
   pn_class_incref(list->clazz, value);
   return 0;
@@ -130,13 +130,6 @@ void pn_list_clear(pn_list_t *list)
   pn_list_del(list, 0, list->size);
 }
 
-void pn_list_fill(pn_list_t *list, void *value, int n)
-{
-  for (int i = 0; i < n; i++) {
-    pn_list_add(list, value);
-  }
-}
-
 void pn_list_minpush(pn_list_t *list, void *value)
 {
   assert(list);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d921c6bc/proton-c/src/object/map.c
----------------------------------------------------------------------
diff --git a/proton-c/src/object/map.c b/proton-c/src/object/map.c
index c969d24..6ae7792 100644
--- a/proton-c/src/object/map.c
+++ b/proton-c/src/object/map.c
@@ -265,7 +265,7 @@ void *pn_map_get(pn_map_t *map, void *key)
   return entry ? entry->value : NULL;
 }
 
-void pn_map_rehash(pn_map_t *map, size_t index)
+static void pni_map_rehash(pn_map_t *map, size_t index)
 {
   //reinsert entries in chain starting at index
   assert(map);
@@ -331,7 +331,7 @@ void pn_map_del(pn_map_t *map, void *key)
     map->size--;
 
     if (orig_state == PNI_ENTRY_LINK) {
-      pn_map_rehash(map, orig_next);
+      pni_map_rehash(map, orig_next);
     }
 
     // do this last as it may trigger further deletions

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d921c6bc/proton-c/src/parser.c
----------------------------------------------------------------------
diff --git a/proton-c/src/parser.c b/proton-c/src/parser.c
index 93b6da4..87cb758 100644
--- a/proton-c/src/parser.c
+++ b/proton-c/src/parser.c
@@ -47,7 +47,7 @@ pn_parser_t *pn_parser()
   return parser;
 }
 
-void pn_parser_ensure(pn_parser_t *parser, size_t size)
+static void pni_parser_ensure(pn_parser_t *parser, size_t size)
 {
   while (parser->capacity - parser->size < size) {
     parser->capacity = parser->capacity ? 2 * parser->capacity : 1024;
@@ -55,11 +55,6 @@ void pn_parser_ensure(pn_parser_t *parser, size_t size)
   }
 }
 
-void pn_parser_line_info(pn_parser_t *parser, int *line, int *col)
-{
-  pn_scanner_line_info(parser->scanner, line, col);
-}
-
 int pn_parser_err(pn_parser_t *parser, int code, const char *fmt, ...)
 {
   va_list ap;
@@ -88,29 +83,29 @@ void pn_parser_free(pn_parser_t *parser)
   }
 }
 
-int pn_parser_shift(pn_parser_t *parser)
+static int pni_parser_shift(pn_parser_t *parser)
 {
   return pn_scanner_shift(parser->scanner);
 }
 
-pn_token_t pn_parser_token(pn_parser_t *parser)
+static pn_token_t pni_parser_token(pn_parser_t *parser)
 {
   return pn_scanner_token(parser->scanner);
 }
 
-int pn_parser_value(pn_parser_t *parser, pn_data_t *data);
+static int pni_parser_value(pn_parser_t *parser, pn_data_t *data);
 
-int pn_parser_descriptor(pn_parser_t *parser, pn_data_t *data)
+static int pni_parser_descriptor(pn_parser_t *parser, pn_data_t *data)
 {
-  if (pn_parser_token(parser).type == PN_TOK_AT) {
-    int err = pn_parser_shift(parser);
+  if (pni_parser_token(parser).type == PN_TOK_AT) {
+    int err = pni_parser_shift(parser);
     if (err) return err;
 
     err = pn_data_put_described(data);
     if (err) return pn_parser_err(parser, err, "error writing described");
     pn_data_enter(data);
     for (int i = 0; i < 2; i++) {
-      err = pn_parser_value(parser, data);
+      err = pni_parser_value(parser, data);
       if (err) return err;
     }
     pn_data_exit(data);
@@ -120,10 +115,10 @@ int pn_parser_descriptor(pn_parser_t *parser, pn_data_t *data)
   }
 }
 
-int pn_parser_map(pn_parser_t *parser, pn_data_t *data)
+static int pni_parser_map(pn_parser_t *parser, pn_data_t *data)
 {
-  if (pn_parser_token(parser).type == PN_TOK_LBRACE) {
-    int err = pn_parser_shift(parser);
+  if (pni_parser_token(parser).type == PN_TOK_LBRACE) {
+    int err = pni_parser_shift(parser);
     if (err) return err;
 
     err = pn_data_put_map(data);
@@ -131,23 +126,23 @@ int pn_parser_map(pn_parser_t *parser, pn_data_t *data)
 
     pn_data_enter(data);
 
-    if (pn_parser_token(parser).type != PN_TOK_RBRACE) {
+    if (pni_parser_token(parser).type != PN_TOK_RBRACE) {
       while (true) {
-        err = pn_parser_value(parser, data);
+        err = pni_parser_value(parser, data);
         if (err) return err;
 
-        if (pn_parser_token(parser).type == PN_TOK_EQUAL) {
-          err = pn_parser_shift(parser);
+        if (pni_parser_token(parser).type == PN_TOK_EQUAL) {
+          err = pni_parser_shift(parser);
           if (err) return err;
         } else {
           return pn_parser_err(parser, PN_ERR, "expecting '='");
         }
 
-        err = pn_parser_value(parser, data);
+        err = pni_parser_value(parser, data);
         if (err) return err;
 
-        if (pn_parser_token(parser).type == PN_TOK_COMMA) {
-          err = pn_parser_shift(parser);
+        if (pni_parser_token(parser).type == PN_TOK_COMMA) {
+          err = pni_parser_shift(parser);
           if (err) return err;
         } else {
           break;
@@ -157,8 +152,8 @@ int pn_parser_map(pn_parser_t *parser, pn_data_t *data)
 
     pn_data_exit(data);
 
-    if (pn_parser_token(parser).type == PN_TOK_RBRACE) {
-      return pn_parser_shift(parser);
+    if (pni_parser_token(parser).type == PN_TOK_RBRACE) {
+      return pni_parser_shift(parser);
     } else {
       return pn_parser_err(parser, PN_ERR, "expecting '}'");
     }
@@ -167,12 +162,12 @@ int pn_parser_map(pn_parser_t *parser, pn_data_t *data)
   }
 }
 
-int pn_parser_list(pn_parser_t *parser, pn_data_t *data)
+static int pni_parser_list(pn_parser_t *parser, pn_data_t *data)
 {
   int err;
 
-  if (pn_parser_token(parser).type == PN_TOK_LBRACKET) {
-    err = pn_parser_shift(parser);
+  if (pni_parser_token(parser).type == PN_TOK_LBRACKET) {
+    err = pni_parser_shift(parser);
     if (err) return err;
 
     err = pn_data_put_list(data);
@@ -180,13 +175,13 @@ int pn_parser_list(pn_parser_t *parser, pn_data_t *data)
 
     pn_data_enter(data);
 
-    if (pn_parser_token(parser).type != PN_TOK_RBRACKET) {
+    if (pni_parser_token(parser).type != PN_TOK_RBRACKET) {
       while (true) {
-        err = pn_parser_value(parser, data);
+        err = pni_parser_value(parser, data);
         if (err) return err;
 
-        if (pn_parser_token(parser).type == PN_TOK_COMMA) {
-          err = pn_parser_shift(parser);
+        if (pni_parser_token(parser).type == PN_TOK_COMMA) {
+          err = pni_parser_shift(parser);
           if (err) return err;
         } else {
           break;
@@ -196,8 +191,8 @@ int pn_parser_list(pn_parser_t *parser, pn_data_t *data)
 
     pn_data_exit(data);
 
-    if (pn_parser_token(parser).type == PN_TOK_RBRACKET) {
-      return pn_parser_shift(parser);
+    if (pni_parser_token(parser).type == PN_TOK_RBRACKET) {
+      return pni_parser_shift(parser);
     } else {
       return pn_parser_err(parser, PN_ERR, "expecting ']'");
     }
@@ -206,13 +201,13 @@ int pn_parser_list(pn_parser_t *parser, pn_data_t *data)
   }
 }
 
-void pn_parser_append_tok(pn_parser_t *parser, char *dst, int *idx)
+static void pni_parser_append_tok(pn_parser_t *parser, char *dst, int *idx)
 {
-  memcpy(dst + *idx, pn_parser_token(parser).start, pn_parser_token(parser).size);
-  *idx += pn_parser_token(parser).size;
+  memcpy(dst + *idx, pni_parser_token(parser).start, pni_parser_token(parser).size);
+  *idx += pni_parser_token(parser).size;
 }
 
-int pn_parser_number(pn_parser_t *parser, pn_data_t *data)
+static int pni_parser_number(pn_parser_t *parser, pn_data_t *data)
 {
   bool dbl = false;
   char number[1024];
@@ -221,17 +216,17 @@ int pn_parser_number(pn_parser_t *parser, pn_data_t *data)
 
   bool negate = false;
 
-  if (pn_parser_token(parser).type == PN_TOK_NEG || pn_parser_token(parser).type == PN_TOK_POS) {
-    if (pn_parser_token(parser).type == PN_TOK_NEG)
+  if (pni_parser_token(parser).type == PN_TOK_NEG || pni_parser_token(parser).type == PN_TOK_POS) {
+    if (pni_parser_token(parser).type == PN_TOK_NEG)
       negate = !negate;
-    err = pn_parser_shift(parser);
+    err = pni_parser_shift(parser);
     if (err) return err;
   }
 
-  if (pn_parser_token(parser).type == PN_TOK_FLOAT || pn_parser_token(parser).type == PN_TOK_INT) {
-    dbl = pn_parser_token(parser).type == PN_TOK_FLOAT;
-    pn_parser_append_tok(parser, number, &idx);
-    err = pn_parser_shift(parser);
+  if (pni_parser_token(parser).type == PN_TOK_FLOAT || pni_parser_token(parser).type == PN_TOK_INT) {
+    dbl = pni_parser_token(parser).type == PN_TOK_FLOAT;
+    pni_parser_append_tok(parser, number, &idx);
+    err = pni_parser_shift(parser);
     if (err) return err;
   } else {
     return pn_parser_err(parser, PN_ERR, "expecting FLOAT or INT");
@@ -258,7 +253,7 @@ int pn_parser_number(pn_parser_t *parser, pn_data_t *data)
   return 0;
 }
 
-int pn_parser_unquote(pn_parser_t *parser, char *dst, const char *src, size_t *n)
+static int pni_parser_unquote(pn_parser_t *parser, char *dst, const char *src, size_t *n)
 {
   size_t idx = 0;
   bool escape = false;
@@ -336,29 +331,29 @@ int pn_parser_unquote(pn_parser_t *parser, char *dst, const char *src, size_t *n
   return 0;
 }
 
-int pn_parser_value(pn_parser_t *parser, pn_data_t *data)
+static int pni_parser_value(pn_parser_t *parser, pn_data_t *data)
 {
   int err;
   size_t n;
   char *dst;
 
-  pn_token_t tok = pn_parser_token(parser);
+  pn_token_t tok = pni_parser_token(parser);
 
   switch (tok.type)
   {
   case PN_TOK_AT:
-    return pn_parser_descriptor(parser, data);
+    return pni_parser_descriptor(parser, data);
   case PN_TOK_LBRACE:
-    return pn_parser_map(parser, data);
+    return pni_parser_map(parser, data);
   case PN_TOK_LBRACKET:
-    return pn_parser_list(parser, data);
+    return pni_parser_list(parser, data);
   case PN_TOK_BINARY:
   case PN_TOK_SYMBOL:
   case PN_TOK_STRING:
     n = tok.size;
-    pn_parser_ensure(parser, n);
+    pni_parser_ensure(parser, n);
     dst = parser->atoms + parser->size;
-    err = pn_parser_unquote(parser, dst, tok.start, &n);
+    err = pni_parser_unquote(parser, dst, tok.start, &n);
     if (err) return err;
     parser->size += n;
     switch (tok.type) {
@@ -375,42 +370,42 @@ int pn_parser_value(pn_parser_t *parser, pn_data_t *data)
       return pn_parser_err(parser, PN_ERR, "internal error");
     }
     if (err) return pn_parser_err(parser, err, "error writing string/binary/symbol");
-    return pn_parser_shift(parser);
+    return pni_parser_shift(parser);
   case PN_TOK_POS:
   case PN_TOK_NEG:
   case PN_TOK_FLOAT:
   case PN_TOK_INT:
-    return pn_parser_number(parser, data);
+    return pni_parser_number(parser, data);
   case PN_TOK_TRUE:
     err = pn_data_put_bool(data, true);
     if (err) return pn_parser_err(parser, err, "error writing boolean");
-    return pn_parser_shift(parser);
+    return pni_parser_shift(parser);
   case PN_TOK_FALSE:
     err = pn_data_put_bool(data, false);
     if (err) return pn_parser_err(parser, err, "error writing boolean");
-    return pn_parser_shift(parser);
+    return pni_parser_shift(parser);
   case PN_TOK_NULL:
     err = pn_data_put_null(data);
     if (err) return pn_parser_err(parser, err, "error writing null");
-    return pn_parser_shift(parser);
+    return pni_parser_shift(parser);
   default:
     return pn_parser_err(parser, PN_ERR, "expecting one of '[', '{', STRING, "
                          "SYMBOL, BINARY, true, false, null, NUMBER");
   }
 }
 
-int pn_parser_parse_r(pn_parser_t *parser, pn_data_t *data)
+static int pni_parser_parse_r(pn_parser_t *parser, pn_data_t *data)
 {
   while (true) {
     int err;
-    switch (pn_parser_token(parser).type)
+    switch (pni_parser_token(parser).type)
     {
     case PN_TOK_EOS:
       return 0;
     case PN_TOK_ERR:
       return PN_ERR;
     default:
-      err = pn_parser_value(parser, data);
+      err = pni_parser_value(parser, data);
       if (err) return err;
     }
   }
@@ -421,5 +416,5 @@ int pn_parser_parse(pn_parser_t *parser, const char *str, pn_data_t *data)
   int err = pn_scanner_start(parser->scanner, str);
   if (err) return err;
   parser->size = 0;
-  return pn_parser_parse_r(parser, data);
+  return pni_parser_parse_r(parser, data);
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d921c6bc/proton-c/src/scanner.c
----------------------------------------------------------------------
diff --git a/proton-c/src/scanner.c b/proton-c/src/scanner.c
index ef54db4..84d8e3f 100644
--- a/proton-c/src/scanner.c
+++ b/proton-c/src/scanner.c
@@ -41,7 +41,7 @@ struct pn_scanner_t {
   pn_error_t *error;
 };
 
-const char *pn_token_type(pn_token_type_t type)
+static const char *pni_token_type(pn_token_type_t type)
 {
   switch (type)
   {
@@ -132,7 +132,7 @@ int pn_scanner_verr(pn_scanner_t *scanner, int code, const char *fmt, va_list ap
   int size = scanner->token.size;
   int ln = snprintf(error, ERROR_SIZE,
                     "input line %i column %i %s:'%.*s': ", line, col,
-                    pn_token_type(scanner->token.type),
+                    pni_token_type(scanner->token.type),
                     size, scanner->token.start);
   if (ln >= ERROR_SIZE) {
     return pn_scanner_err(scanner, code, "error info truncated");
@@ -161,14 +161,14 @@ const char *pn_scanner_error(pn_scanner_t *scanner)
   return pn_error_text(scanner->error);
 }
 
-void pn_scanner_emit(pn_scanner_t *scanner, pn_token_type_t type, const char *start, size_t size)
+static void pni_scanner_emit(pn_scanner_t *scanner, pn_token_type_t type, const char *start, size_t size)
 {
   scanner->token.type = type;
   scanner->token.start = start;
   scanner->token.size = size;
 }
 
-int pn_scanner_quoted(pn_scanner_t *scanner, const char *str, int start,
+static int pni_scanner_quoted(pn_scanner_t *scanner, const char *str, int start,
                       pn_token_type_t type)
 {
   bool escape = false;
@@ -181,7 +181,7 @@ int pn_scanner_quoted(pn_scanner_t *scanner, const char *str, int start,
       switch (c) {
       case '\0':
       case '"':
-        pn_scanner_emit(scanner, c ? type : PN_TOK_ERR,
+        pni_scanner_emit(scanner, c ? type : PN_TOK_ERR,
                         str, c ? i + 1 : i);
         return c ? 0 : pn_scanner_err(scanner, PN_ERR, "missmatched quote");
       case '\\':
@@ -192,17 +192,17 @@ int pn_scanner_quoted(pn_scanner_t *scanner, const char *str, int start,
   }
 }
 
-int pn_scanner_binary(pn_scanner_t *scanner, const char *str)
+static int pni_scanner_binary(pn_scanner_t *scanner, const char *str)
 {
-  return pn_scanner_quoted(scanner, str, 2, PN_TOK_BINARY);
+  return pni_scanner_quoted(scanner, str, 2, PN_TOK_BINARY);
 }
 
-int pn_scanner_string(pn_scanner_t *scanner, const char *str)
+static int pni_scanner_string(pn_scanner_t *scanner, const char *str)
 {
-  return pn_scanner_quoted(scanner, str, 1, PN_TOK_STRING);
+  return pni_scanner_quoted(scanner, str, 1, PN_TOK_STRING);
 }
 
-int pn_scanner_alpha_end(pn_scanner_t *scanner, const char *str, int start)
+static int pni_scanner_alpha_end(pn_scanner_t *scanner, const char *str, int start)
 {
   for (int i = start; true; i++) {
     char c = str[i];
@@ -212,9 +212,9 @@ int pn_scanner_alpha_end(pn_scanner_t *scanner, const char *str, int start)
   }
 }
 
-int pn_scanner_alpha(pn_scanner_t *scanner, const char *str)
+static int pni_scanner_alpha(pn_scanner_t *scanner, const char *str)
 {
-  int n = pn_scanner_alpha_end(scanner, str, 0);
+  int n = pni_scanner_alpha_end(scanner, str, 0);
   pn_token_type_t type;
   if (!strncmp(str, "true", n)) {
     type = PN_TOK_TRUE;
@@ -226,24 +226,24 @@ int pn_scanner_alpha(pn_scanner_t *scanner, const char *str)
     type = PN_TOK_ID;
   }
 
-  pn_scanner_emit(scanner, type, str, n);
+  pni_scanner_emit(scanner, type, str, n);
   return type == PN_TOK_ERR ? pn_scanner_err(scanner, PN_ERR, "unrecognized keyword") : 0;
 }
 
-int pn_scanner_symbol(pn_scanner_t *scanner, const char *str)
+static int pni_scanner_symbol(pn_scanner_t *scanner, const char *str)
 {
   char c = str[1];
 
   if (c == '"') {
-    return pn_scanner_quoted(scanner, str, 2, PN_TOK_SYMBOL);
+    return pni_scanner_quoted(scanner, str, 2, PN_TOK_SYMBOL);
   } else {
-    int n = pn_scanner_alpha_end(scanner, str, 1);
-    pn_scanner_emit(scanner, PN_TOK_SYMBOL, str, n);
+    int n = pni_scanner_alpha_end(scanner, str, 1);
+    pni_scanner_emit(scanner, PN_TOK_SYMBOL, str, n);
     return 0;
   }
 }
 
-int pn_scanner_number(pn_scanner_t *scanner, const char *str)
+static int pni_scanner_number(pn_scanner_t *scanner, const char *str)
 {
   bool dot = false;
   bool exp = false;
@@ -262,7 +262,7 @@ int pn_scanner_number(pn_scanner_t *scanner, const char *str)
       continue;
     case '.':
       if (dot) {
-        pn_scanner_emit(scanner, PN_TOK_FLOAT, str, i);
+        pni_scanner_emit(scanner, PN_TOK_FLOAT, str, i);
         return 0;
       } else {
         dot = true;
@@ -271,7 +271,7 @@ int pn_scanner_number(pn_scanner_t *scanner, const char *str)
     case 'e':
     case 'E':
       if (exp) {
-        pn_scanner_emit(scanner, PN_TOK_FLOAT, str, i);
+        pni_scanner_emit(scanner, PN_TOK_FLOAT, str, i);
         return 0;
       } else {
         dot = true;
@@ -283,19 +283,19 @@ int pn_scanner_number(pn_scanner_t *scanner, const char *str)
       }
     default:
       if (dot || exp) {
-        pn_scanner_emit(scanner, PN_TOK_FLOAT, str, i);
+        pni_scanner_emit(scanner, PN_TOK_FLOAT, str, i);
         return 0;
       } else {
-        pn_scanner_emit(scanner, PN_TOK_INT, str, i);
+        pni_scanner_emit(scanner, PN_TOK_INT, str, i);
         return 0;
       }
     }
   }
 }
 
-int pn_scanner_single(pn_scanner_t *scanner, const char *str, pn_token_type_t type)
+static int pni_scanner_single(pn_scanner_t *scanner, const char *str, pn_token_type_t type)
 {
-  pn_scanner_emit(scanner, type, str, 1);
+  pni_scanner_emit(scanner, type, str, 1);
   return 0;
 }
 
@@ -317,54 +317,54 @@ int pn_scanner_scan(pn_scanner_t *scanner)
     switch (c)
     {
     case '{':
-      return pn_scanner_single(scanner, str, PN_TOK_LBRACE);
+      return pni_scanner_single(scanner, str, PN_TOK_LBRACE);
     case '}':
-      return pn_scanner_single(scanner, str, PN_TOK_RBRACE);
+      return pni_scanner_single(scanner, str, PN_TOK_RBRACE);
     case'[':
-      return pn_scanner_single(scanner, str, PN_TOK_LBRACKET);
+      return pni_scanner_single(scanner, str, PN_TOK_LBRACKET);
     case ']':
-      return pn_scanner_single(scanner, str, PN_TOK_RBRACKET);
+      return pni_scanner_single(scanner, str, PN_TOK_RBRACKET);
     case '=':
-      return pn_scanner_single(scanner, str, PN_TOK_EQUAL);
+      return pni_scanner_single(scanner, str, PN_TOK_EQUAL);
     case ',':
-      return pn_scanner_single(scanner, str, PN_TOK_COMMA);
+      return pni_scanner_single(scanner, str, PN_TOK_COMMA);
     case '.':
       n = *(str+1);
       if ((n >= '0' && n <= '9')) {
-        return pn_scanner_number(scanner, str);
+        return pni_scanner_number(scanner, str);
       } else {
-        return pn_scanner_single(scanner, str, PN_TOK_DOT);
+        return pni_scanner_single(scanner, str, PN_TOK_DOT);
       }
     case '@':
-      return pn_scanner_single(scanner, str, PN_TOK_AT);
+      return pni_scanner_single(scanner, str, PN_TOK_AT);
     case '$':
-      return pn_scanner_single(scanner, str, PN_TOK_DOLLAR);
+      return pni_scanner_single(scanner, str, PN_TOK_DOLLAR);
     case '-':
       n = *(str+1);
       if ((n >= '0' && n <= '9') || n == '.') {
-        return pn_scanner_number(scanner, str);
+        return pni_scanner_number(scanner, str);
       } else {
-        return pn_scanner_single(scanner, str, PN_TOK_NEG);
+        return pni_scanner_single(scanner, str, PN_TOK_NEG);
       }
     case '+':
       n = *(str+1);
       if ((n >= '0' && n <= '9') || n == '.') {
-        return pn_scanner_number(scanner, str);
+        return pni_scanner_number(scanner, str);
       } else {
-        return pn_scanner_single(scanner, str, PN_TOK_POS);
+        return pni_scanner_single(scanner, str, PN_TOK_POS);
       }
     case ' ': case '\t': case '\r': case '\v': case '\f': case '\n':
       break;
     case '0': case '1': case '2': case '3': case '4': case '5': case '6':
     case '7': case '8': case '9':
-      return pn_scanner_number(scanner, str);
+      return pni_scanner_number(scanner, str);
     case ':':
-      return pn_scanner_symbol(scanner, str);
+      return pni_scanner_symbol(scanner, str);
     case '"':
-      return pn_scanner_string(scanner, str);
+      return pni_scanner_string(scanner, str);
     case 'b':
       if (str[1] == '"') {
-        return pn_scanner_binary(scanner, str);
+        return pni_scanner_binary(scanner, str);
       }
     case 'a': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h':
     case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o':
@@ -374,12 +374,12 @@ int pn_scanner_scan(pn_scanner_t *scanner)
     case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q':
     case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
     case 'Y': case 'Z':
-      return pn_scanner_alpha(scanner, str);
+      return pni_scanner_alpha(scanner, str);
     case '\0':
-      pn_scanner_emit(scanner, PN_TOK_EOS, str, 0);
+      pni_scanner_emit(scanner, PN_TOK_EOS, str, 0);
       return PN_EOS;
     default:
-      pn_scanner_emit(scanner, PN_TOK_ERR, str, 1);
+      pni_scanner_emit(scanner, PN_TOK_ERR, str, 1);
       return pn_scanner_err(scanner, PN_ERR, "illegal character");
     }
   }


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


[11/50] [abbrv] qpid-proton git commit: PROTON-895: fix the Cyrus SASL check

Posted by kg...@apache.org.
PROTON-895: fix the Cyrus SASL check


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

Branch: refs/heads/kgiusti-python3
Commit: e32f047c665686c827adb6a55f4f447c5d477644
Parents: d921c6b
Author: Ken Giusti <kg...@apache.org>
Authored: Mon Jun 8 13:47:21 2015 -0400
Committer: Ken Giusti <kg...@apache.org>
Committed: Mon Jun 8 13:47:21 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/python/setup.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e32f047c/proton-c/bindings/python/setup.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/setup.py b/proton-c/bindings/python/setup.py
index b255580..79168d2 100755
--- a/proton-c/bindings/python/setup.py
+++ b/proton-c/bindings/python/setup.py
@@ -191,7 +191,8 @@ class Configure(build_ext):
         # if it is available before adding the implementation to the sources
         # list. Eventually, `sasl.c` will be added and one of the existing
         # implementations will be used.
-        if not cc.has_function('sasl_set_path', libraries=('sasl2')):
+        if cc.has_function('sasl_client_done', includes=['sasl/sasl.h'],
+                           libraries=['sasl2']):
             libraries.append('sasl2')
             sources.append(os.path.join(proton_src, 'sasl', 'cyrus_sasl.c'))
         else:


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


[19/50] [abbrv] qpid-proton git commit: PROTON-334: Add capability to detect extended SASL support

Posted by kg...@apache.org.
PROTON-334: Add capability to detect extended SASL support


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

Branch: refs/heads/kgiusti-python3
Commit: d7df5760f979a2e0503b272638067493fd5b9e7b
Parents: 7346d23
Author: Andrew Stitcher <as...@apache.org>
Authored: Thu Jun 11 13:53:04 2015 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Thu Jun 11 16:19:54 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/python/proton/__init__.py |  4 ++++
 proton-c/include/proton/sasl.h              | 13 +++++++++++++
 proton-c/src/sasl/cyrus_sasl.c              |  5 +++++
 proton-c/src/sasl/none_sasl.c               |  5 +++++
 proton-j/src/main/resources/csasl.py        |  3 +++
 5 files changed, 30 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d7df5760/proton-c/bindings/python/proton/__init__.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/__init__.py b/proton-c/bindings/python/proton/__init__.py
index e3cd9e3..9432bd8 100644
--- a/proton-c/bindings/python/proton/__init__.py
+++ b/proton-c/bindings/python/proton/__init__.py
@@ -3368,6 +3368,10 @@ class SASL(Wrapper):
   PERM = PN_SASL_PERM
   TEMP = PN_SASL_TEMP
 
+  @staticmethod
+  def extended():
+    return pn_sasl_extended()
+
   def __init__(self, transport):
     Wrapper.__init__(self, transport._impl, pn_transport_attachments)
     self._sasl = pn_sasl(transport._impl)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d7df5760/proton-c/include/proton/sasl.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/sasl.h b/proton-c/include/proton/sasl.h
index b2a8a27..60ee7d5 100644
--- a/proton-c/include/proton/sasl.h
+++ b/proton-c/include/proton/sasl.h
@@ -68,6 +68,19 @@ typedef enum {
  */
 PN_EXTERN pn_sasl_t *pn_sasl(pn_transport_t *transport);
 
+/** Do we support extended SASL negotiation
+ *
+ * Do we support extended SASL negotiation?
+ * All implementations of Proton support ANONYMOUS and EXTERNAL on both
+ * client and server sides and PLAIN on the client side.
+ *
+ * Extended SASL implememtations use an external library (Cyrus SASL)
+ * to support other mechanisms beyond these basic ones.
+ *
+ * @return true if we support extended SASL negotiation, false if we only support basic negotiation.
+ */
+PN_EXTERN bool pn_sasl_extended(void);
+
 /** Set the outcome of SASL negotiation
  *
  * Used by the server to set the result of the negotiation process.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d7df5760/proton-c/src/sasl/cyrus_sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/cyrus_sasl.c b/proton-c/src/sasl/cyrus_sasl.c
index 31703a8..b42ffa5 100644
--- a/proton-c/src/sasl/cyrus_sasl.c
+++ b/proton-c/src/sasl/cyrus_sasl.c
@@ -380,3 +380,8 @@ void pni_sasl_impl_free(pn_transport_t *transport)
         sasl_server_done();
     }
 }
+
+bool pn_sasl_extended(void)
+{
+  return true;
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d7df5760/proton-c/src/sasl/none_sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/none_sasl.c b/proton-c/src/sasl/none_sasl.c
index 4a2dc13..be27871 100644
--- a/proton-c/src/sasl/none_sasl.c
+++ b/proton-c/src/sasl/none_sasl.c
@@ -171,3 +171,8 @@ void pni_process_challenge(pn_transport_t *transport, const pn_bytes_t *recv)
 void pni_process_response(pn_transport_t *transport, const pn_bytes_t *recv)
 {
 }
+
+bool pn_sasl_extended(void)
+{
+  return false;
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d7df5760/proton-j/src/main/resources/csasl.py
----------------------------------------------------------------------
diff --git a/proton-j/src/main/resources/csasl.py b/proton-j/src/main/resources/csasl.py
index ea5e489..32f8039 100644
--- a/proton-j/src/main/resources/csasl.py
+++ b/proton-j/src/main/resources/csasl.py
@@ -30,6 +30,9 @@ PN_SASL_SYS=2
 PN_SASL_PERM=3
 PN_SASL_TEMP=4
 
+def pn_sasl_extended():
+  return False
+
 def pn_sasl(tp):
   sasl = tp.impl.sasl()
   if tp.server:


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


[21/50] [abbrv] qpid-proton git commit: PROTON-909: Tests for Cyrus SASL mechs

Posted by kg...@apache.org.
PROTON-909: Tests for Cyrus SASL mechs


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

Branch: refs/heads/kgiusti-python3
Commit: 990b11e8a3e3b7a63c891b42e22ea3d180278e55
Parents: e55fe32
Author: Andrew Stitcher <as...@apache.org>
Authored: Tue Jun 2 03:26:44 2015 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Thu Jun 11 16:20:28 2015 -0400

----------------------------------------------------------------------
 proton-j/src/main/resources/csasl.py |  16 ++
 tests/python/proton_tests/sasl.py    | 248 +++++++++++++++++++++++++++++-
 2 files changed, 258 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/990b11e8/proton-j/src/main/resources/csasl.py
----------------------------------------------------------------------
diff --git a/proton-j/src/main/resources/csasl.py b/proton-j/src/main/resources/csasl.py
index 32f8039..b36b104 100644
--- a/proton-j/src/main/resources/csasl.py
+++ b/proton-j/src/main/resources/csasl.py
@@ -62,6 +62,22 @@ SASL_OUTCOMES_J2P = {
 def pn_transport_require_auth(transport, require):
   transport.impl.sasl().allowSkip(not require)
 
+# TODO: Placeholders
+def pn_transport_is_authenticated(transport):
+  raise Skipped('Not supported in Proton-J')
+
+def pn_transport_is_encrypted(transport):
+  raise Skipped('Not supported in Proton-J')
+
+def pn_transport_get_user(transport):
+  raise Skipped('Not supported in Proton-J')
+
+def pn_connection_set_user(connection, user):
+  pass
+
+def pn_connection_set_password(connection, password):
+  pass
+
 def pn_sasl_allowed_mechs(sasl, mechs):
   sasl.setMechanisms(*mechs.split())
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/990b11e8/tests/python/proton_tests/sasl.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/sasl.py b/tests/python/proton_tests/sasl.py
index 68fb6e3..91b3e69 100644
--- a/tests/python/proton_tests/sasl.py
+++ b/tests/python/proton_tests/sasl.py
@@ -18,9 +18,69 @@
 #
 
 import sys, os, common
+from string import Template
+import subprocess
+
 from proton import *
 from common import pump, Skipped
 
+from cproton import *
+
+def _sslCertpath(file):
+    """ Return the full path to the certificate,keyfile, etc.
+    """
+    return os.path.join(os.path.dirname(__file__),
+                        "ssl_db/%s" % file)
+
+def _cyrusSetup(conf_dir):
+  """Write out simple SASL config
+  """
+  t = Template("""sasldb_path: ${db}
+mech_list: EXTERNAL DIGEST-MD5 SCRAM-SHA-1 CRAM-MD5 PLAIN ANONYMOUS
+""")
+  subprocess.call(args=['rm','-rf',conf_dir])
+  os.mkdir(conf_dir)
+  db = os.path.abspath(os.path.join(conf_dir,'proton.sasldb'))
+  conf = os.path.abspath(os.path.join(conf_dir,'proton.conf'))
+  f = open(conf, 'w')
+  f.write(t.substitute(db=db))
+  f.close()
+
+  cmd = Template("echo password | saslpasswd2 -c -p -f ${db} -u proton user").substitute(db=db)
+  subprocess.call(args=cmd, shell=True)
+
+def _testSaslMech(self, mech, clientUser='user@proton', authUser='user@proton', encrypted=False, authenticated=True):
+  self.s1.allowed_mechs(mech)
+  self.c1.open()
+
+  pump(self.t1, self.t2, 1024)
+
+  if encrypted:
+    assert self.t2.encrypted == encrypted
+    assert self.t1.encrypted == encrypted
+  assert self.t2.authenticated == authenticated
+  assert self.t1.authenticated == authenticated
+  if authenticated:
+    # Server
+    assert self.t2.user == authUser
+    assert self.s2.user == authUser
+    assert self.s2.mech == mech.strip()
+    assert self.s2.outcome == SASL.OK
+    # Client
+    assert self.t1.user == clientUser
+    assert self.s1.user == clientUser
+    assert self.s1.mech == mech.strip()
+    assert self.s1.outcome == SASL.OK
+  else:
+    # Server
+    assert self.t2.user == None
+    assert self.s2.user == None
+    assert self.s2.outcome != SASL.OK
+    # Client
+    assert self.t1.user == clientUser
+    assert self.s1.user == clientUser
+    assert self.s1.outcome != SASL.OK
+
 class Test(common.Test):
   pass
 
@@ -32,6 +92,13 @@ class SaslTest(Test):
     self.t2 = Transport(Transport.SERVER)
     self.s2 = SASL(self.t2)
 
+    if not SASL.extended():
+      return
+
+    _cyrusSetup('sasl_conf')
+    self.s2.config_name('proton')
+    self.s2.config_path(os.path.abspath('sasl_conf'))
+
   def pump(self):
     pump(self.t1, self.t2, 1024)
 
@@ -215,11 +282,11 @@ class SaslTest(Test):
     self.t2.require_auth(False)
     self.pump()
     assert self.s2.outcome == None
-    self.t2.condition == None
-    self.t2.authenticated == False
+    assert self.t2.condition == None
+    assert self.t2.authenticated == False
     assert self.s1.outcome == None
-    self.t1.condition == None
-    self.t1.authenticated == False
+    assert self.t1.condition == None
+    assert self.t1.authenticated == False
 
   def testSaslSkippedFail(self):
     """Verify that the server (with SASL) correctly handles a client without SASL"""
@@ -227,6 +294,175 @@ class SaslTest(Test):
     self.t2.require_auth(True)
     self.pump()
     assert self.s2.outcome == None
-    self.t2.condition != None
+    assert self.t2.condition != None
     assert self.s1.outcome == None
-    self.t1.condition != None
+    assert self.t1.condition != None
+
+  def testMechNotFound(self):
+    if "java" in sys.platform:
+      raise Skipped("Proton-J does not support checking authentication state")
+    self.c1 = Connection()
+    self.c1.open()
+    self.t1.bind(self.c1)
+    self.s1.allowed_mechs('IMPOSSIBLE')
+
+    self.pump()
+
+    assert self.t2.authenticated == False
+    assert self.t1.authenticated == False
+    assert self.s1.outcome != SASL.OK
+    assert self.s2.outcome != SASL.OK
+
+class CyrusSASLTest(Test):
+  def setup(self):
+    self.t1 = Transport()
+    self.s1 = SASL(self.t1)
+    self.t2 = Transport(Transport.SERVER)
+    self.s2 = SASL(self.t2)
+
+    self.c1 = Connection()
+    self.c1.user = 'user@proton'
+    self.c1.password = 'password'
+    self.c1.hostname = 'localhost'
+
+    if not SASL.extended():
+      return
+
+    _cyrusSetup('sasl_conf')
+    self.s2.config_name('proton')
+    self.s2.config_path(os.path.abspath('sasl_conf'))
+
+  def testMechANON(self):
+    self.t1.bind(self.c1)
+    _testSaslMech(self, 'ANONYMOUS', authUser='anonymous')
+
+  def testMechCRAMMD5(self):
+    if not SASL.extended():
+      raise Skipped('Extended SASL not supported')
+
+    self.t1.bind(self.c1)
+    _testSaslMech(self, 'CRAM-MD5')
+
+  def testMechDIGESTMD5(self):
+    if not SASL.extended():
+      raise Skipped('Extended SASL not supported')
+
+    self.t1.bind(self.c1)
+    _testSaslMech(self, 'DIGEST-MD5')
+
+# SCRAM not supported before Cyrus SASL 2.1.26
+# so not universal and hance need a test for support
+# to keep it in tests.
+#  def testMechSCRAMSHA1(self):
+#    if not SASL.extended():
+#      raise Skipped('Extended SASL not supported')
+#
+#    self.t1.bind(self.c1)
+#    _testSaslMech(self, 'SCRAM-SHA-1')
+
+def _sslConnection(domain, transport, connection):
+  transport.bind(connection)
+  ssl = SSL(transport, domain, None )
+  return connection
+
+class SSLSASLTest(Test):
+  def setup(self):
+    if not common.isSSLPresent():
+      raise Skipped("No SSL libraries found.")
+
+    self.server_domain = SSLDomain(SSLDomain.MODE_SERVER)
+    self.client_domain = SSLDomain(SSLDomain.MODE_CLIENT)
+
+    self.t1 = Transport()
+    self.s1 = SASL(self.t1)
+    self.t2 = Transport(Transport.SERVER)
+    self.s2 = SASL(self.t2)
+
+    self.c1 = Connection()
+
+    if not SASL.extended():
+      return
+
+    _cyrusSetup('sasl_conf')
+    self.s2.config_name('proton')
+    self.s2.config_path(os.path.abspath('sasl_conf'))
+
+  def testSSLPlainSimple(self):
+    if "java" in sys.platform:
+      raise Skipped("Proton-J does not support SSL with SASL")
+    if not SASL.extended():
+      raise Skipped("Simple SASL server does not support PLAIN")
+
+    clientUser = 'user@proton'
+    mech = 'PLAIN'
+
+    self.c1.user = clientUser
+    self.c1.password = 'password'
+    self.c1.hostname = 'localhost'
+
+    ssl1 = _sslConnection(self.client_domain, self.t1, self.c1)
+    ssl2 = _sslConnection(self.server_domain, self.t2, Connection())
+
+    _testSaslMech(self, mech, encrypted=True)
+
+  def testSSLPlainSimpleFail(self):
+    if "java" in sys.platform:
+      raise Skipped("Proton-J does not support SSL with SASL")
+    if not SASL.extended():
+      raise Skipped("Simple SASL server does not support PLAIN")
+
+    clientUser = 'usr@proton'
+    mech = 'PLAIN'
+
+    self.c1.user = clientUser
+    self.c1.password = 'password'
+    self.c1.hostname = 'localhost'
+
+    ssl1 = _sslConnection(self.client_domain, self.t1, self.c1)
+    ssl2 = _sslConnection(self.server_domain, self.t2, Connection())
+
+    _testSaslMech(self, mech, clientUser='usr@proton', encrypted=True, authenticated=False)
+
+  def testSSLExternalSimple(self):
+    if "java" in sys.platform:
+      raise Skipped("Proton-J does not support SSL with SASL")
+
+    extUser = 'O=Client,CN=127.0.0.1'
+    mech = 'EXTERNAL'
+
+    self.server_domain.set_credentials(_sslCertpath("server-certificate.pem"),
+                                       _sslCertpath("server-private-key.pem"),
+                                       "server-password")
+    self.server_domain.set_trusted_ca_db(_sslCertpath("ca-certificate.pem"))
+    self.server_domain.set_peer_authentication(SSLDomain.VERIFY_PEER,
+                                               _sslCertpath("ca-certificate.pem") )
+    self.client_domain.set_credentials(_sslCertpath("client-certificate.pem"),
+                                       _sslCertpath("client-private-key.pem"),
+                                       "client-password")
+    self.client_domain.set_trusted_ca_db(_sslCertpath("ca-certificate.pem"))
+    self.client_domain.set_peer_authentication(SSLDomain.VERIFY_PEER)
+
+    ssl1 = _sslConnection(self.client_domain, self.t1, self.c1)
+    ssl2 = _sslConnection(self.server_domain, self.t2, Connection())
+
+    _testSaslMech(self, mech, clientUser=None, authUser=extUser, encrypted=True)
+
+  def testSSLExternalSimpleFail(self):
+    if "java" in sys.platform:
+      raise Skipped("Proton-J does not support SSL with SASL")
+
+    mech = 'EXTERNAL'
+
+    self.server_domain.set_credentials(_sslCertpath("server-certificate.pem"),
+                                       _sslCertpath("server-private-key.pem"),
+                                       "server-password")
+    self.server_domain.set_trusted_ca_db(_sslCertpath("ca-certificate.pem"))
+    self.server_domain.set_peer_authentication(SSLDomain.VERIFY_PEER,
+                                               _sslCertpath("ca-certificate.pem") )
+    self.client_domain.set_trusted_ca_db(_sslCertpath("ca-certificate.pem"))
+    self.client_domain.set_peer_authentication(SSLDomain.VERIFY_PEER)
+
+    ssl1 = _sslConnection(self.client_domain, self.t1, self.c1)
+    ssl2 = _sslConnection(self.server_domain, self.t2, Connection())
+
+    _testSaslMech(self, mech, clientUser=None, authUser=None, encrypted=None, authenticated=False)


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


[23/50] [abbrv] qpid-proton git commit: PROTON-904: fix javascript build after removal of liuuid as dependency of proton-c

Posted by kg...@apache.org.
PROTON-904: fix javascript build after removal of liuuid as dependency of proton-c


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

Branch: refs/heads/kgiusti-python3
Commit: 75fc98fd70bf563dfebdf6b47e55ee83d2c0fc7e
Parents: f6e1948
Author: Gordon Sim <gs...@redhat.com>
Authored: Fri Jun 12 20:03:59 2015 +0100
Committer: Gordon Sim <gs...@redhat.com>
Committed: Fri Jun 12 20:03:59 2015 +0100

----------------------------------------------------------------------
 proton-c/bindings/javascript/CMakeLists.txt | 9 +++++++--
 proton-c/bindings/javascript/binding.c      | 2 ++
 2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/75fc98fd/proton-c/bindings/javascript/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/javascript/CMakeLists.txt b/proton-c/bindings/javascript/CMakeLists.txt
index 699cf07..5a87baf 100644
--- a/proton-c/bindings/javascript/CMakeLists.txt
+++ b/proton-c/bindings/javascript/CMakeLists.txt
@@ -77,6 +77,10 @@ set(pn_ssl_impl ${PN_PATH}/src/ssl/ssl_stub.c)
 set(pn_io_impl ${PN_PATH}/src/posix/io.c)
 set(pn_selector_impl ${PN_PATH}/src/posix/selector.c)
 
+CHECK_LIBRARY_EXISTS (uuid uuid_generate "" UUID_GENERATE_IN_UUID)
+if (UUID_GENERATE_IN_UUID)
+  set (UUID_LIB uuid)
+endif (UUID_GENERATE_IN_UUID)
 
 # Generate encodings.h and protocol.h
 # It may be possible to use the ones generated for the main proton-c build but
@@ -183,6 +187,7 @@ set_target_properties(
   SOVERSION "${PN_LIB_SOMAJOR}"
   LINK_FLAGS "${CATCH_UNDEFINED}"
   )
+target_link_libraries(qpid-proton-bitcode)
 
 
 # Compile the send-async.c and recv-async.c examples into JavaScript
@@ -204,7 +209,7 @@ set_target_properties(
 
 # Build the main JavaScript library called proton-messenger.js
 add_executable(proton-messenger.js binding.c)
-target_link_libraries(proton-messenger.js qpid-proton-bitcode)
+target_link_libraries(proton-messenger.js qpid-proton-bitcode ${UUID_LIB})
 
 set_target_properties(
   proton-messenger.js
@@ -217,7 +222,7 @@ set_target_properties(
   # more fiddly with node.js packages. This behaviour might be reinstated if the
   # packaging mechanism improves.
 
-  LINK_FLAGS "-s \"EXPORT_NAME='proton'\" -s \"WEBSOCKET_SUBPROTOCOL='AMQPWSB10'\" ${EMSCRIPTEN_LINK_OPTIMISATIONS} --memory-init-file 0 --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/binding-open.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/module.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/error.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/messenger.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/subscription.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/message.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-uuid.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-symbol.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-described.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-array.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-typed-number.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-long.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-binary.js --post-js ${CMAKE_CURRENT_SOURCE_DIR}/binding-close.js -s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\"[]\" -s EXPORTED_FUNCTIONS=\"['_pn_get_version_major', '_
 pn_get_version_minor', '_pn_bytes', '_pn_error_text', '_pn_code', '_pn_messenger', '_pn_messenger_name', '_pn_messenger_set_blocking', '_pn_messenger_free', '_pn_messenger_errno', '_pn_messenger_error', '_pn_messenger_get_outgoing_window', '_pn_messenger_set_outgoing_window', '_pn_messenger_get_incoming_window', '_pn_messenger_set_incoming_window', '_pn_messenger_start', '_pn_messenger_stop', '_pn_messenger_stopped', '_pn_messenger_subscribe', '_pn_messenger_put', '_pn_messenger_status', '_pn_messenger_buffered', '_pn_messenger_settle', '_pn_messenger_outgoing_tracker', '_pn_messenger_recv', '_pn_messenger_receiving', '_pn_messenger_get', '_pn_messenger_incoming_tracker', '_pn_messenger_incoming_subscription', '_pn_messenger_accept', '_pn_messenger_reject', '_pn_messenger_outgoing', '_pn_messenger_incoming',  '_pn_messenger_route', '_pn_messenger_rewrite', '_pn_messenger_set_passive', '_pn_messenger_selectable', '_pn_subscription_get_context', '_pn_subscription_set_context', '_pn_su
 bscription_address', '_pn_message', '_pn_message_id', '_pn_message_correlation_id', '_pn_message_free', '_pn_message_errno', '_pn_message_error', '_pn_message_clear', '_pn_message_is_inferred', '_pn_message_set_inferred', '_pn_message_is_durable', '_pn_message_set_durable', '_pn_message_get_priority', '_pn_message_set_priority', '_pn_message_get_ttl', '_pn_message_set_ttl', '_pn_message_is_first_acquirer', '_pn_message_set_first_acquirer', '_pn_message_get_delivery_count', '_pn_message_set_delivery_count', '_pn_message_get_user_id', '_pn_message_set_user_id', '_pn_message_get_address', '_pn_message_set_address', '_pn_message_get_subject', '_pn_message_set_subject', '_pn_message_get_reply_to', '_pn_message_set_reply_to', '_pn_message_get_content_type', '_pn_message_set_content_type', '_pn_message_get_content_encoding', '_pn_message_set_content_encoding', '_pn_message_get_expiry_time', '_pn_message_set_expiry_time', '_pn_message_get_creation_time', '_pn_message_set_creation_time', '_p
 n_message_get_group_id', '_pn_message_set_group_id', '_pn_message_get_group_sequence', '_pn_message_set_group_sequence', '_pn_message_get_reply_to_group_id', '_pn_message_set_reply_to_group_id', '_pn_message_encode', '_pn_message_decode', '_pn_message_instructions', '_pn_message_annotations', '_pn_message_properties', '_pn_message_body', '_pn_data', '_pn_data_free', '_pn_data_error', '_pn_data_errno', '_pn_data_clear', '_pn_data_rewind', '_pn_data_next', '_pn_data_prev', '_pn_data_enter', '_pn_data_exit', '_pn_data_lookup', '_pn_data_narrow', '_pn_data_widen', '_pn_data_type', '_pn_data_encode', '_pn_data_decode', '_pn_data_put_list', '_pn_data_put_map', '_pn_data_put_array', '_pn_data_put_described', '_pn_data_put_null', '_pn_data_put_bool', '_pn_data_put_ubyte', '_pn_data_put_byte', '_pn_data_put_ushort', '_pn_data_put_short', '_pn_data_put_uint', '_pn_data_put_int', '_pn_data_put_char', '_pn_data_put_ulong', '_pn_data_put_long', '_pn_data_put_timestamp', '_pn_data_put_float', '_p
 n_data_put_double', '_pn_data_put_decimal32', '_pn_data_put_decimal64', '_pn_data_put_decimal128', '_pn_data_put_uuid', '_pn_data_put_binary', '_pn_data_put_string', '_pn_data_put_symbol', '_pn_data_get_list', '_pn_data_get_map', '_pn_data_get_array', '_pn_data_is_array_described', '_pn_data_get_array_type', '_pn_data_is_described', '_pn_data_is_null', '_pn_data_get_bool', '_pn_data_get_ubyte', '_pn_data_get_byte', '_pn_data_get_ushort', '_pn_data_get_short', '_pn_data_get_uint', '_pn_data_get_int', '_pn_data_get_char', '_pn_data_get_ulong', '_pn_data_get_long', '_pn_data_get_timestamp', '_pn_data_get_float', '_pn_data_get_double', '_pn_data_get_decimal32', '_pn_data_get_decimal64', '_pn_data_get_decimal128', '_pn_data_get_uuid', '_pn_data_get_binary', '_pn_data_get_string', '_pn_data_get_symbol', '_pn_data_copy', '_pn_data_format', '_pn_data_dump', '_pn_selectable_readable', '_pn_selectable_is_reading', '_pn_selectable_writable', '_pn_selectable_is_writing', '_pn_selectable_is_term
 inal', '_pn_selectable_get_fd', '_pn_selectable_free']\""
+  LINK_FLAGS "-s \"EXPORT_NAME='proton'\" -s \"WEBSOCKET_SUBPROTOCOL='AMQPWSB10'\" ${EMSCRIPTEN_LINK_OPTIMISATIONS} --memory-init-file 0 --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/binding-open.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/module.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/error.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/messenger.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/subscription.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/message.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-uuid.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-symbol.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-described.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-array.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-typed-number.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-long.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-binary.js --post-js ${CMAKE_CURRENT_SOURCE_DIR}/binding-close.js -s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\"[]\" -s EXPORTED_FUNCTIONS=\"['_pn_get_version_major', '_
 pn_get_version_minor', '_pn_uuid_generate', '_pn_bytes', '_pn_error_text', '_pn_code', '_pn_messenger', '_pn_messenger_name', '_pn_messenger_set_blocking', '_pn_messenger_free', '_pn_messenger_errno', '_pn_messenger_error', '_pn_messenger_get_outgoing_window', '_pn_messenger_set_outgoing_window', '_pn_messenger_get_incoming_window', '_pn_messenger_set_incoming_window', '_pn_messenger_start', '_pn_messenger_stop', '_pn_messenger_stopped', '_pn_messenger_subscribe', '_pn_messenger_put', '_pn_messenger_status', '_pn_messenger_buffered', '_pn_messenger_settle', '_pn_messenger_outgoing_tracker', '_pn_messenger_recv', '_pn_messenger_receiving', '_pn_messenger_get', '_pn_messenger_incoming_tracker', '_pn_messenger_incoming_subscription', '_pn_messenger_accept', '_pn_messenger_reject', '_pn_messenger_outgoing', '_pn_messenger_incoming',  '_pn_messenger_route', '_pn_messenger_rewrite', '_pn_messenger_set_passive', '_pn_messenger_selectable', '_pn_subscription_get_context', '_pn_subscription_
 set_context', '_pn_subscription_address', '_pn_message', '_pn_message_id', '_pn_message_correlation_id', '_pn_message_free', '_pn_message_errno', '_pn_message_error', '_pn_message_clear', '_pn_message_is_inferred', '_pn_message_set_inferred', '_pn_message_is_durable', '_pn_message_set_durable', '_pn_message_get_priority', '_pn_message_set_priority', '_pn_message_get_ttl', '_pn_message_set_ttl', '_pn_message_is_first_acquirer', '_pn_message_set_first_acquirer', '_pn_message_get_delivery_count', '_pn_message_set_delivery_count', '_pn_message_get_user_id', '_pn_message_set_user_id', '_pn_message_get_address', '_pn_message_set_address', '_pn_message_get_subject', '_pn_message_set_subject', '_pn_message_get_reply_to', '_pn_message_set_reply_to', '_pn_message_get_content_type', '_pn_message_set_content_type', '_pn_message_get_content_encoding', '_pn_message_set_content_encoding', '_pn_message_get_expiry_time', '_pn_message_set_expiry_time', '_pn_message_get_creation_time', '_pn_message_se
 t_creation_time', '_pn_message_get_group_id', '_pn_message_set_group_id', '_pn_message_get_group_sequence', '_pn_message_set_group_sequence', '_pn_message_get_reply_to_group_id', '_pn_message_set_reply_to_group_id', '_pn_message_encode', '_pn_message_decode', '_pn_message_instructions', '_pn_message_annotations', '_pn_message_properties', '_pn_message_body', '_pn_data', '_pn_data_free', '_pn_data_error', '_pn_data_errno', '_pn_data_clear', '_pn_data_rewind', '_pn_data_next', '_pn_data_prev', '_pn_data_enter', '_pn_data_exit', '_pn_data_lookup', '_pn_data_narrow', '_pn_data_widen', '_pn_data_type', '_pn_data_encode', '_pn_data_decode', '_pn_data_put_list', '_pn_data_put_map', '_pn_data_put_array', '_pn_data_put_described', '_pn_data_put_null', '_pn_data_put_bool', '_pn_data_put_ubyte', '_pn_data_put_byte', '_pn_data_put_ushort', '_pn_data_put_short', '_pn_data_put_uint', '_pn_data_put_int', '_pn_data_put_char', '_pn_data_put_ulong', '_pn_data_put_long', '_pn_data_put_timestamp', '_pn
 _data_put_float', '_pn_data_put_double', '_pn_data_put_decimal32', '_pn_data_put_decimal64', '_pn_data_put_decimal128', '_pn_data_put_uuid', '_pn_data_put_binary', '_pn_data_put_string', '_pn_data_put_symbol', '_pn_data_get_list', '_pn_data_get_map', '_pn_data_get_array', '_pn_data_is_array_described', '_pn_data_get_array_type', '_pn_data_is_described', '_pn_data_is_null', '_pn_data_get_bool', '_pn_data_get_ubyte', '_pn_data_get_byte', '_pn_data_get_ushort', '_pn_data_get_short', '_pn_data_get_uint', '_pn_data_get_int', '_pn_data_get_char', '_pn_data_get_ulong', '_pn_data_get_long', '_pn_data_get_timestamp', '_pn_data_get_float', '_pn_data_get_double', '_pn_data_get_decimal32', '_pn_data_get_decimal64', '_pn_data_get_decimal128', '_pn_data_get_uuid', '_pn_data_get_binary', '_pn_data_get_string', '_pn_data_get_symbol', '_pn_data_copy', '_pn_data_format', '_pn_data_dump', '_pn_selectable_readable', '_pn_selectable_is_reading', '_pn_selectable_writable', '_pn_selectable_is_writing', '_
 pn_selectable_is_terminal', '_pn_selectable_get_fd', '_pn_selectable_free']\""
   )
 
 # This command packages up the compiled proton-messenger.js into a node.js package

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/75fc98fd/proton-c/bindings/javascript/binding.c
----------------------------------------------------------------------
diff --git a/proton-c/bindings/javascript/binding.c b/proton-c/bindings/javascript/binding.c
index ecc65dc..8da83f6 100644
--- a/proton-c/bindings/javascript/binding.c
+++ b/proton-c/bindings/javascript/binding.c
@@ -25,10 +25,12 @@
  * this is it. This file also provides a way to pass any global variable or
  * #defined values to the JavaScript binding by providing wrapper functions.
  */
+#include <uuid/uuid.h>
 #include <stdio.h>
 #include <proton/version.h>
 
 // To access #define values in JavaScript we need to wrap them in a function.
 int pn_get_version_major() {return PN_VERSION_MAJOR;}
 int pn_get_version_minor() {return PN_VERSION_MINOR;}
+void pn_uuid_generate(uuid_t out) { uuid_generate(out); }
 


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


[35/50] [abbrv] qpid-proton git commit: PROTON-916: copy SASL config name to allow bindings to release the name

Posted by kg...@apache.org.
PROTON-916: copy SASL config name to allow bindings to release the name


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

Branch: refs/heads/kgiusti-python3
Commit: 5b611b704441c508541b444300fbeb398ef61f80
Parents: 718d8b3
Author: Ken Giusti <kg...@apache.org>
Authored: Wed Jun 17 15:01:55 2015 -0400
Committer: Ken Giusti <kg...@apache.org>
Committed: Wed Jun 17 15:01:55 2015 -0400

----------------------------------------------------------------------
 proton-c/src/sasl/sasl-internal.h | 2 +-
 proton-c/src/sasl/sasl.c          | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5b611b70/proton-c/src/sasl/sasl-internal.h
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/sasl-internal.h b/proton-c/src/sasl/sasl-internal.h
index 40df261..71205f5 100644
--- a/proton-c/src/sasl/sasl-internal.h
+++ b/proton-c/src/sasl/sasl-internal.h
@@ -61,7 +61,7 @@ struct pni_sasl_t {
   char *included_mechanisms;
   const char *username;
   char *password;
-  const char *config_name;
+  char *config_name;
   char *config_dir;
   const char *remote_fqdn;
   char *external_auth;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5b611b70/proton-c/src/sasl/sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/sasl.c b/proton-c/src/sasl/sasl.c
index c339ea9..47084ee 100644
--- a/proton-c/src/sasl/sasl.c
+++ b/proton-c/src/sasl/sasl.c
@@ -366,7 +366,7 @@ pn_sasl_t *pn_sasl(pn_transport_t *transport)
     sasl->included_mechanisms = NULL;
     sasl->username = NULL;
     sasl->password = NULL;
-    sasl->config_name = sasl->client ? "proton-client" : "proton-server";
+    sasl->config_name = pn_strdup(sasl->client ? "proton-client" : "proton-server");
     sasl->config_dir =  sasl_config_path ? pn_strdup(sasl_config_path) : NULL;
     sasl->remote_fqdn = NULL;
     sasl->external_auth = NULL;
@@ -455,7 +455,8 @@ void pn_sasl_allowed_mechs(pn_sasl_t *sasl0, const char *mechs)
 void pn_sasl_config_name(pn_sasl_t *sasl0, const char *name)
 {
     pni_sasl_t *sasl = get_sasl_internal(sasl0);
-    sasl->config_name = name;
+    free(sasl->config_name);
+    sasl->config_name = pn_strdup(name);
 }
 
 void pn_sasl_config_path(pn_sasl_t *sasl0, const char *dir)
@@ -487,6 +488,7 @@ void pn_sasl_free(pn_transport_t *transport)
       free(sasl->selected_mechanism);
       free(sasl->included_mechanisms);
       free(sasl->password);
+      free(sasl->config_name);
       free(sasl->config_dir);
       free(sasl->external_auth);
 


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


[44/50] [abbrv] qpid-proton git commit: NO-JIRA: temporary skip of Mick's session tests - he's fixing it now

Posted by kg...@apache.org.
NO-JIRA: temporary skip of Mick's session tests - he's fixing it now


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

Branch: refs/heads/kgiusti-python3
Commit: 98e27c681e5700483fddc574d890acaee1bdf0c5
Parents: 824dfef
Author: Ken Giusti <kg...@apache.org>
Authored: Thu Jun 18 13:53:53 2015 -0400
Committer: Ken Giusti <kg...@apache.org>
Committed: Thu Jun 18 13:53:53 2015 -0400

----------------------------------------------------------------------
 tests/python/proton_tests/engine.py | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/98e27c68/tests/python/proton_tests/engine.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/engine.py b/tests/python/proton_tests/engine.py
index 1563889..e3258a2 100644
--- a/tests/python/proton_tests/engine.py
+++ b/tests/python/proton_tests/engine.py
@@ -221,12 +221,16 @@ class ConnectionTest(Test):
     assert self.c1.transport.channel_max == value, (self.c1.transport.channel_max, value)
 
   def test_channel_max_high(self, value=33333):
+    if "java" in sys.platform:
+      raise Skipped("Mick needs to fix me")
     self.c1.transport.channel_max = value
     self.c1.open()
     self.pump()
     assert self.c1.transport.channel_max == 32767, (self.c1.transport.channel_max, value)
 
   def test_channel_max_raise_and_lower(self):
+    if "java" in sys.platform:
+      raise Skipped("Mick needs to fix me, also")
     # It's OK to lower the max below 32767.
     self.c1.transport.channel_max = 12345
     assert self.c1.transport.channel_max == 12345


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


[38/50] [abbrv] qpid-proton git commit: PROTON-916: Avoid unnecessary heap allocation

Posted by kg...@apache.org.
PROTON-916: Avoid unnecessary heap allocation


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

Branch: refs/heads/kgiusti-python3
Commit: 638c18b33d4dd8f10692b975f522053a2ed4f980
Parents: 5b611b7
Author: Andrew Stitcher <as...@apache.org>
Authored: Wed Jun 17 18:17:31 2015 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Wed Jun 17 18:28:39 2015 -0400

----------------------------------------------------------------------
 proton-c/src/sasl/cyrus_sasl.c | 2 +-
 proton-c/src/sasl/sasl.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/638c18b3/proton-c/src/sasl/cyrus_sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/cyrus_sasl.c b/proton-c/src/sasl/cyrus_sasl.c
index b42ffa5..c84d0af 100644
--- a/proton-c/src/sasl/cyrus_sasl.c
+++ b/proton-c/src/sasl/cyrus_sasl.c
@@ -245,7 +245,7 @@ bool pni_init_server(pn_transport_t* transport)
         if (result!=SASL_OK) break;
     }
 
-    result = sasl_server_init(NULL, sasl->config_name);
+    result = sasl_server_init(NULL, sasl->config_name ? sasl->config_name : "proton-server");
     if (result!=SASL_OK) break;
 
     result = sasl_server_new(amqp_service, NULL, NULL, NULL, NULL, NULL, 0, &cyrus_conn);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/638c18b3/proton-c/src/sasl/sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/sasl.c b/proton-c/src/sasl/sasl.c
index 47084ee..2e6be06 100644
--- a/proton-c/src/sasl/sasl.c
+++ b/proton-c/src/sasl/sasl.c
@@ -366,7 +366,7 @@ pn_sasl_t *pn_sasl(pn_transport_t *transport)
     sasl->included_mechanisms = NULL;
     sasl->username = NULL;
     sasl->password = NULL;
-    sasl->config_name = pn_strdup(sasl->client ? "proton-client" : "proton-server");
+    sasl->config_name = NULL;
     sasl->config_dir =  sasl_config_path ? pn_strdup(sasl_config_path) : NULL;
     sasl->remote_fqdn = NULL;
     sasl->external_auth = NULL;


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


[41/50] [abbrv] qpid-proton git commit: PROTON-799: Update CMake INSTALL for 81a5449

Posted by kg...@apache.org.
PROTON-799: Update CMake INSTALL for 81a5449


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

Branch: refs/heads/kgiusti-python3
Commit: 175a15a8773a3c04ca3e84673ce4e35f612e8639
Parents: 83f424f
Author: Dominic Evans <do...@uk.ibm.com>
Authored: Thu Jun 18 11:04:32 2015 +0100
Committer: Dominic Evans <do...@uk.ibm.com>
Committed: Thu Jun 18 11:04:32 2015 +0100

----------------------------------------------------------------------
 proton-c/bindings/ruby/CMakeLists.txt | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/175a15a8/proton-c/bindings/ruby/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/CMakeLists.txt b/proton-c/bindings/ruby/CMakeLists.txt
index e42db32..c6b07d3 100644
--- a/proton-c/bindings/ruby/CMakeLists.txt
+++ b/proton-c/bindings/ruby/CMakeLists.txt
@@ -68,6 +68,22 @@ install(TARGETS cproton-ruby
 install(FILES lib/qpid_proton.rb
         DESTINATION ${RUBY_ARCHLIB_DIR}
         COMPONENT Ruby)
-install(DIRECTORY lib/qpid_proton
+install(DIRECTORY lib/codec
         DESTINATION ${RUBY_ARCHLIB_DIR}
         COMPONENT Ruby)
+install(DIRECTORY lib/core
+        DESTINATION ${RUBY_ARCHLIB_DIR}
+        COMPONENT Ruby)
+install(DIRECTORY lib/event
+        DESTINATION ${RUBY_ARCHLIB_DIR}
+        COMPONENT Ruby)
+install(DIRECTORY lib/messenger
+        DESTINATION ${RUBY_ARCHLIB_DIR}
+        COMPONENT Ruby)
+install(DIRECTORY lib/types
+        DESTINATION ${RUBY_ARCHLIB_DIR}
+        COMPONENT Ruby)
+install(DIRECTORY lib/util
+        DESTINATION ${RUBY_ARCHLIB_DIR}
+        COMPONENT Ruby)
+


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


[46/50] [abbrv] qpid-proton git commit: PROTON-490: Merge all sections into testenv

Posted by kg...@apache.org.
PROTON-490: Merge all sections into testenv

(cherry picked from commit 33f486b59975d7bb10c48ad419ad7f1d5cf20e6f)


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

Branch: refs/heads/kgiusti-python3
Commit: 13cc7292b947d64abc5512a5d0afa6e7cf072350
Parents: 6069e1f
Author: Flavio Percoco <fl...@gmail.com>
Authored: Thu Jun 18 09:58:40 2015 +0200
Committer: Ken Giusti <kg...@apache.org>
Committed: Thu Jun 18 14:00:28 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/python/tox.ini | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/13cc7292/proton-c/bindings/python/tox.ini
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/tox.ini b/proton-c/bindings/python/tox.ini
index 6bbe1fc..8a8c87c 100644
--- a/proton-c/bindings/python/tox.ini
+++ b/proton-c/bindings/python/tox.ini
@@ -6,6 +6,7 @@ skipdist = True
 [testenv]
 usedevelop = False
 #changedir = {toxinidir}/../../proton-c/include/
+platform = linux|linux2
 setenv =
     VIRTUAL_ENV={envdir}
     PKG_CONFIG_PATH=None
@@ -22,12 +23,3 @@ commands = flake8
 
 [testenv:docs]
 commands = python setup.py build_sphinx
-
-[testenv:py27]
-platform = linux|linux2
-
-[testenv:py33]
-platform = linux|linux2
-
-[testenv:py34]
-platform = linux|linux2


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


[37/50] [abbrv] qpid-proton git commit: PROTON-490: include python3.3 in allowable test cases

Posted by kg...@apache.org.
PROTON-490: include python3.3 in allowable test cases


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

Branch: refs/heads/kgiusti-python3
Commit: dff246b0b6e7f8fac38ed217e30910cbdf07eeea
Parents: 0d1da5c
Author: Ken Giusti <kg...@apache.org>
Authored: Wed Jun 17 15:58:10 2015 -0400
Committer: Ken Giusti <kg...@apache.org>
Committed: Wed Jun 17 15:58:10 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/python/tox.ini | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/dff246b0/proton-c/bindings/python/tox.ini
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/tox.ini b/proton-c/bindings/python/tox.ini
index acfa5a1..6bbe1fc 100644
--- a/proton-c/bindings/python/tox.ini
+++ b/proton-c/bindings/python/tox.ini
@@ -1,5 +1,5 @@
 [tox]
-envlist = py27,py34
+envlist = py27,py33,py34
 minversion = 1.4
 skipdist = True
 
@@ -26,5 +26,8 @@ commands = python setup.py build_sphinx
 [testenv:py27]
 platform = linux|linux2
 
+[testenv:py33]
+platform = linux|linux2
+
 [testenv:py34]
-platform = linux|linux2
\ No newline at end of file
+platform = linux|linux2


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


[26/50] [abbrv] qpid-proton git commit: PROTON-490: Make setup py34 compatible

Posted by kg...@apache.org.
PROTON-490: Make setup py34 compatible


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

Branch: refs/heads/kgiusti-python3
Commit: fc3f4f5b1592e6b57f5e64a691a96d91c6742d5f
Parents: 2721c63
Author: Flavio Percoco <fl...@gmail.com>
Authored: Sun Jun 14 00:08:02 2015 +0200
Committer: Ken Giusti <kg...@apache.org>
Committed: Mon Jun 15 13:28:30 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/python/setup.py |  7 +++++--
 proton-c/bindings/python/tox.ini  | 19 ++++++++++++-------
 2 files changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fc3f4f5b/proton-c/bindings/python/setup.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/setup.py b/proton-c/bindings/python/setup.py
index 84b5a66..e6fbb79 100755
--- a/proton-c/bindings/python/setup.py
+++ b/proton-c/bindings/python/setup.py
@@ -149,7 +149,7 @@ class Configure(build_ext):
 #define PN_VERSION_MINOR %i
 #endif /* version.h */
 """ % bundle.min_qpid_proton
-            ver.write(version_text)
+            ver.write(version_text.encode('utf-8'))
 
         # Collect all the C files that need to be built.
         # we could've used `glob(.., '*', '*.c')` but I preferred going
@@ -269,6 +269,9 @@ class Configure(build_ext):
 
         _cproton.runtime_library_dirs.extend([install_lib])
 
+        if sys.version_info.major >= 3:
+            _cproton.libraries[0] = "qpid-proton%s" % ds_sys.get_config_var('EXT_SUFFIX')[:-3]
+
         # Register this new extension and make
         # sure it's built and installed *before* `_cproton`.
         self.distribution.ext_modules.insert(0, libqpid_proton)
@@ -283,7 +286,7 @@ class Configure(build_ext):
     @property
     def bundle_proton(self):
         """Bundled proton if the conditions below are met."""
-        return sys.platform == 'linux2' and not self.check_qpid_proton_version()
+        return 'linux' in sys.platform and not self.check_qpid_proton_version()
 
     def run(self):
         if self.bundle_proton:

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fc3f4f5b/proton-c/bindings/python/tox.ini
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/tox.ini b/proton-c/bindings/python/tox.ini
index dddfe74..b2277da 100644
--- a/proton-c/bindings/python/tox.ini
+++ b/proton-c/bindings/python/tox.ini
@@ -1,9 +1,10 @@
 [tox]
-envlist = build
+envlist = build,py34
 minversion = 1.4
 skipdist = True
 
 [testenv]
+usedevelop = False
 changedir = {toxinidir}/../../proton-c/include/
 setenv =
     VIRTUAL_ENV={envdir}
@@ -11,8 +12,7 @@ passenv =
     PKG_CONFIG_PATH
     CFLAGS
 commands =
-    pip install -e {toxinidir}
-    tests/python/proton-test {posargs}
+    {toxinidir}/../../../tests/python/proton-test {posargs}
 
 [testenv:pep8]
 commands = flake8
@@ -20,13 +20,18 @@ commands = flake8
 [testenv:docs]
 commands = python setup.py build_sphinx
 
+[testenv:py34]
+platform = linux
+setenv =
+    VIRTUAL_ENV={envdir}
+    PKG_CONFIG_PATH=None
+    QPID_PROTON_SRC={toxinidir}/../../../
+    DEBUG=True
+
 [testenv:build]
-usedevelop = False
 platform = linux2
 setenv =
     VIRTUAL_ENV={envdir}
     PKG_CONFIG_PATH=None
     QPID_PROTON_SRC={toxinidir}/../../../
-    DEBUG=True
-commands =
-    {toxinidir}/../../../tests/python/proton-test {posargs}
\ No newline at end of file
+    DEBUG=True
\ No newline at end of file


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


[07/50] [abbrv] qpid-proton git commit: PROTON-895: Rely on python to build downloaded tarball

Posted by kg...@apache.org.
PROTON-895: Rely on python to build downloaded tarball

Instead of using cmake to build the downloaded tarball, rely on python
for building and installing the library. This process is not only
cleaner but also plays nicer with the environment we're trying to give
support to.

In addition to the above, this plays nicer with the user and removes a
requirement for having the library installed. Note that the built
library will no longer overwrite system libraries but it'll be placed
along to the python bindings we're building.

(cherry picked from commit f2e97708a9c0da049bbc5089909fc31ab092edf8)


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

Branch: refs/heads/kgiusti-python3
Commit: 3db3cf1783f1b91211028842389801316d10b8ba
Parents: caaabb7
Author: Flavio Percoco <fl...@gmail.com>
Authored: Fri May 29 15:14:48 2015 +0200
Committer: Ken Giusti <kg...@apache.org>
Committed: Fri Jun 5 09:02:38 2015 -0400

----------------------------------------------------------------------
 proton-c/CMakeLists.txt                       |  26 +-
 proton-c/bindings/python/setup.py             | 286 ++++++++++++++-------
 proton-c/bindings/python/setuputils/bundle.py |   4 +-
 proton-c/bindings/python/setuputils/log.py    |   2 +-
 proton-c/bindings/python/setuputils/misc.py   |  88 +------
 proton-c/bindings/python/tox.ini              |  36 +++
 tests/python/proton_tests/common.py           |  12 +-
 7 files changed, 276 insertions(+), 178 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3db3cf17/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index 1347f16..b534e86 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -501,6 +501,7 @@ endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
 
 # python test: tests/python/proton-test
 if (BUILD_PYTHON)
+  set (pn_c_root "${CMAKE_BINARY_DIR}/proton")
   set (py_root "${pn_test_root}/python")
   set (py_src "${CMAKE_CURRENT_SOURCE_DIR}/bindings/python")
   set (py_bin "${CMAKE_CURRENT_BINARY_DIR}/bindings/python")
@@ -515,7 +516,7 @@ if (BUILD_PYTHON)
   to_native_path ("${py_pythonpath}" py_pythonpath)
   add_test (NAME python-test
             COMMAND ${env_py}
-                    "PATH=${py_path}" "PYTHONPATH=${py_pythonpath}" ${VALGRIND_ENV}
+	             "PATH=${py_path}" "PYTHONPATH=${py_pythonpath}" "PKG_CONFIG_PATH=${pn_c_root}" ${VALGRIND_ENV}
                     ${PYTHON_EXECUTABLE} "${py_root}/proton-test")
   set_tests_properties(python-test PROPERTIES PASS_REGULAR_EXPRESSION "Totals: .* 0 failed")
   else (NOT OLD_ADD_TEST_COMMAND)
@@ -524,11 +525,32 @@ if (BUILD_PYTHON)
   to_native_path ("${py_pythonpath}" py_pythonpath)
   add_test (python-test
             ${env_py}
-            "PATH=${py_path}" "PYTHONPATH=${py_pythonpath}" ${VALGRIND_ENV}
+	    "PATH=${py_path}" "PYTHONPATH=${py_pythonpath}" "PKG_CONFIG_PATH=${pn_c_root}" ${VALGRIND_ENV}
             ${PYTHON_EXECUTABLE} "${py_root}/proton-test")
   set_tests_properties(python-test PROPERTIES PASS_REGULAR_EXPRESSION "Totals: .* 0 failed")
   endif (NOT OLD_ADD_TEST_COMMAND)
 
+  # Eventually, we'll get rid of this check when other
+  # platforms will be supported. Since `setup.py` will skip
+  # the build for non linux plaforms, it doesn't make sense
+  # to try to run them.
+  if (CMAKE_SYSTEM_NAME STREQUAL Linux)
+     find_program(TOX_CMD "tox")
+     if (TOX_CMD)
+         list (APPEND py_path "${Proton_BINARY_DIR}/tests/tools/apps/c")
+         to_native_path ("${py_path}" py_path)
+         to_native_path ("${py_pythonpath}" py_pythonpath)
+         add_test (NAME python-tox-test
+                   COMMAND ${env_py}
+		   "PATH=${py_path}" ${VALGRIND_ENV}
+                   tox
+		   WORKING_DIRECTORY ${py_src})
+         set_tests_properties(python-tox-test PROPERTIES PASS_REGULAR_EXPRESSION "Totals: .* 0 failed")
+     else (TOX_CMD)
+         message(STATUS "The tox tool is not available - skipping the python-tox-tests")
+     endif (TOX_CMD)
+  endif (CMAKE_SYSTEM_NAME STREQUAL Linux)
+
 endif (BUILD_PYTHON)
 
 find_program(RUBY_EXE "ruby")

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3db3cf17/proton-c/bindings/python/setup.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/setup.py b/proton-c/bindings/python/setup.py
index 09fa76a..b255580 100755
--- a/proton-c/bindings/python/setup.py
+++ b/proton-c/bindings/python/setup.py
@@ -67,12 +67,14 @@ in the system. The rest of the comands and steps are done normally without any k
 of monkey patching.
 """
 
+import glob
 import os
 import subprocess
 import sys
 
 import distutils.spawn as ds_spawn
 import distutils.sysconfig as ds_sys
+from distutils.ccompiler import new_compiler, get_default_compiler
 from distutils.core import setup, Extension
 from distutils.command.build import build
 from distutils.command.build_ext import build_ext
@@ -82,102 +84,193 @@ from setuputils import log
 from setuputils import misc
 
 
-class CustomBuildOrder(build):
-    # NOTE(flaper87): The sole purpose of this class is to re-order
-    # the commands execution so that `build_ext` is executed *before*
-    # build_py. We need this to make sure `cproton.py` is generated
-    # before the python modules are collected. Otherwise, it won't
-    # be installed.
-    sub_commands = [
-        ('build_ext', build.has_ext_modules),
-        ('build_py', build.has_pure_modules),
-        ('build_clib', build.has_c_libraries),
-        ('build_scripts', build.has_scripts),
-    ]
-
-
-class CheckingBuildExt(build_ext):
-    """Subclass build_ext to build qpid-proton using `cmake`"""
-
-    def build_extensions(self):
-        self.check_extensions_list(self.extensions)
-
-        for ext in self.extensions:
-            self.build_extension(ext)
-
-    def build_cmake_proton(self, ext):
-        if not ds_spawn.find_executable('cmake'):
-            log.fatal("cmake needed for this script it work")
-
-        try:
-            ds_spawn.spawn(['cmake'] + ext.extra_compile_args + ext.sources)
-            ds_spawn.spawn(['make', 'install'])
-        except ds_spawn.DistutilsExecError:
-            msg = "Error while running cmake"
-            msg += "\nrun 'setup.py build --help' for build options"
-            log.fatal(msg)
-
-    def build_extension(self, ext):
-        if ext.name == 'cmake_cproton':
-            return self.build_cmake_proton(ext)
-
-        return build_ext.build_extension(self, ext)
-
-    def run(self):
-        # Discover qpid-proton in the system
-        self.distribution.run_command('configure')
-        build_ext.run(self)
-
-
 class Configure(build_ext):
     description = "Discover Qpid Proton version"
 
+    @property
+    def compiler_type(self):
+        compiler = self.compiler
+        if compiler is None:
+            return get_default_compiler()
+        elif isinstance(compiler, str):
+            return compiler
+        else:
+            return compiler.compiler_type
+
     def bundle_libqpid_proton_extension(self):
         base = self.get_finalized_command('build').build_base
+        build_include = os.path.join(base, 'include')
         install = self.get_finalized_command('install').install_base
-        bundledir = os.path.join(base, "bundled")
+        install_lib = self.get_finalized_command('install').install_lib
         ext_modules = self.distribution.ext_modules
 
         log.info("Using bundled libqpid-proton")
 
-        if not os.path.exists(bundledir):
-            os.makedirs(bundledir)
-
-        bundle.fetch_libqpid_proton(bundledir)
-
-        libqpid_proton_dir = os.path.join(bundledir, 'qpid-proton')
-
-        # NOTE(flaper87): Find prefix. We need to run make ourselves
+        if 'QPID_PROTON_SRC' not in os.environ:
+            bundledir = os.path.join(base, "bundled")
+            if not os.path.exists(bundledir):
+                os.makedirs(bundledir)
+            bundle.fetch_libqpid_proton(bundledir)
+            libqpid_proton_dir = os.path.abspath(os.path.join(bundledir, 'qpid-proton'))
+        else:
+            libqpid_proton_dir = os.path.abspath(os.environ['QPID_PROTON_SRC'])
+
+        log.debug("Using libqpid-proton src: %s" % libqpid_proton_dir)
+
+        proton_base = os.path.join(libqpid_proton_dir, 'proton-c')
+        proton_src = os.path.join(proton_base, 'src')
+        proton_include = os.path.join(proton_base, 'include')
+
+        if not os.path.exists(build_include):
+            os.makedirs(build_include)
+            os.mkdir(os.path.join(build_include, 'proton'))
+
+        # Generate `protocol.h` by calling the python
+        # script found in the source dir.
+        with open(os.path.join(build_include, 'protocol.h'), 'wb') as header:
+            subprocess.Popen([sys.executable, os.path.join(proton_src, 'protocol.h.py')],
+                              env={'PYTHONPATH': proton_base}, stdout=header)
+
+        # Generate `encodings.h` by calling the python
+        # script found in the source dir.
+        with open(os.path.join(build_include, 'encodings.h'), 'wb') as header:
+            subprocess.Popen([sys.executable,
+                              os.path.join(proton_src, 'codec', 'encodings.h.py')],
+                              env={'PYTHONPATH': proton_base}, stdout=header)
+
+        # Create a custom, temporary, version.h file mapping the
+        # major and minor versions from the downloaded tarbal. This version should
+        # match the ones in the bundle module
+        with open(os.path.join(build_include, 'proton', 'version.h'), "wb") as ver:
+            version_text = """
+#ifndef _PROTON_VERSION_H
+#define _PROTON_VERSION_H 1
+#define PN_VERSION_MAJOR %i
+#define PN_VERSION_MINOR %i
+#endif /* version.h */
+""" % bundle.min_qpid_proton
+            ver.write(version_text)
+
+        # Collect all the C files that need to be built.
+        # we could've used `glob(.., '*', '*.c')` but I preferred going
+        # with an explicit list of subdirs that we can control and expand
+        # depending on the version. Specifically, lets avoid adding things
+        # we don't need.
+        sources = []
+        libraries = ['uuid']
+
+        for subdir in ['object', 'framing', 'codec', 'dispatcher',
+                       'engine', 'events', 'transport',
+                       'message', 'reactor', 'messenger',
+                       'handlers', 'posix']:
+
+            sources.extend(glob.glob(os.path.join(proton_src, subdir, '*.c')))
+
+        sources.extend(filter(lambda x: not x.endswith('dump.c'),
+                       glob.iglob(os.path.join(proton_src, '*.c'))))
+
+        # Check whether openssl is installed by poking
+        # pkg-config for a minimum version 0. If it's installed, it should
+        # return True and we'll use it. Otherwise, we'll use the stub.
+        if misc.pkg_config_version(atleast='0', module='openssl'):
+            libraries += ['ssl', 'crypto']
+            sources.append(os.path.join(proton_src, 'ssl', 'openssl.c'))
+        else:
+            sources.append(os.path.join(proton_src, 'ssl', 'ssl_stub.c'))
+
+        cc = new_compiler(compiler=self.compiler_type)
+        cc.output_dir = self.build_temp
+
+        # Some systems need to link to
+        # `rt`. Check whether `clock_getttime` is around
+        # and if not, link on rt.
+        if not cc.has_function('clock_getttime'):
+            libraries.append('rt')
+
+        # 0.10 added an implementation for cyrus. Check
+        # if it is available before adding the implementation to the sources
+        # list. Eventually, `sasl.c` will be added and one of the existing
+        # implementations will be used.
+        if not cc.has_function('sasl_set_path', libraries=('sasl2')):
+            libraries.append('sasl2')
+            sources.append(os.path.join(proton_src, 'sasl', 'cyrus_sasl.c'))
+        else:
+            sources.append(os.path.join(proton_src, 'sasl', 'none_sasl.c'))
+
+        sources.append(os.path.join(proton_src, 'sasl', 'sasl.c'))
+
+        # Create an extension for the bundled qpid-proton
+        # library and let distutils do the build step for us.
+        # This is not the `swig` library... What's going to be built by this
+        # `Extension` is qpid-proton itself. For the swig library, pls, see the
+        # dependencies in the `setup` function call and how it's extended further
+        # down this method.
         libqpid_proton = Extension(
-            'cmake_cproton',
-            sources = [libqpid_proton_dir],
-
-            # NOTE(flaper87): Disable all bindings, set the prefix to whatever
-            # is in `distutils.sysconfig.PREFIX` and finally, disable testing
-            # as well. The python binding will be built by this script later
-            # on. Don't let cmake do it.
-            extra_compile_args = ['-DCMAKE_INSTALL_PREFIX:PATH=%s' % install,
-                                  '-DBUILD_PYTHON=False',
-                                  '-DBUILD_JAVA=False',
-                                  '-DBUILD_PERL=False',
-                                  '-DBUILD_RUBY=False',
-                                  '-DBUILD_PHP=False',
-                                  '-DBUILD_JAVASCRIPT=False',
-                                  '-DBUILD_TESTING=False',
-            ]
+            'libqpid-proton',
+
+            # List of `.c` files that will be compiled.
+            # `sources` is defined earlier on in this method and it's mostly
+            # filled dynamically except for a few cases where files are added
+            # depending on the presence of some libraries.
+            sources=sources,
+
+            # Libraries that need to be linked to should
+            # be added to this list. `libraries` is defined earlier on
+            # in this same method and it's filled depending on some
+            # conditions. You'll find comments on each of those.
+            libraries=libraries,
+
+            # Changes to this list should be rare.
+            # However, this is where new headers' dirs are added.
+            # This list translates to `-I....` flags.
+            include_dirs=[build_include, proton_src, proton_include],
+
+            # If you need to add a default flag, this is
+            # the place. All these compile arguments will be appended to
+            # the GCC command. This list of flags is not used during the
+            # linking phase.
+            extra_compile_args = [
+                '-std=gnu99',
+                '-Dqpid_proton_EXPORTS',
+                '-DUSE_ATOLL',
+                '-DUSE_CLOCK_GETTIME',
+                '-DUSE_STRERROR_R',
+                '-DUSE_UUID_GENERATE',
+            ],
+
+            # If you need to add flags to the linking phase
+            # this is the right place to do it. Just like the compile flags,
+            # this is a list of flags that will be appended to the link
+            # command.
+            extra_link_args = []
         )
 
-        # NOTE(flaper87): Register this new extension and make
+
+        # Extend the `swig` module `Extension` and add a few
+        # extra options. For instance, we'll add new library dirs where `swig`
+        # should look for headers and libraries. In addition to this, we'll
+        # also append a `runtime path` where the qpid-proton library for this
+        # swig extension should be looked up from whenever the proton bindings
+        # are imported. We need this because the library will live in the
+        # site-packages along with the proton bindings instead of being in the
+        # common places like `/usr/lib` or `/usr/local/lib`.
+        #
+        # This is not the place where you'd add "default" flags. If you need to
+        # add flags like `-thread` please read the `setup` function call at the
+        # bottom of this file and see the examples there.
+        _cproton = self.distribution.ext_modules[-1]
+        _cproton.library_dirs.append(self.build_lib)
+        _cproton.include_dirs.append(proton_include)
+        _cproton.include_dirs.append(os.path.join(proton_src, 'bindings', 'python'))
+
+        _cproton.swig_opts.append('-I%s' % build_include)
+        _cproton.swig_opts.append('-I%s' % proton_include)
+
+        _cproton.runtime_library_dirs.extend([install_lib])
+
+        # Register this new extension and make
         # sure it's built and installed *before* `_cproton`.
         self.distribution.ext_modules.insert(0, libqpid_proton)
-        return install
-
-    def set_cproton_settings(self, prefix=None):
-        settings = misc.settings_from_prefix(prefix)
-        ext = self.distribution.ext_modules[-1]
-
-        for k, v in settings.items():
-            setattr(ext, k, v)
 
     def check_qpid_proton_version(self):
         """check the qpid_proton version"""
@@ -186,20 +279,40 @@ class Configure(build_ext):
         return (misc.pkg_config_version(max_version=target_version) and
                 misc.pkg_config_version(atleast=bundle.min_qpid_proton_str))
 
-
     @property
     def bundle_proton(self):
+        """Bundled proton if the conditions below are met."""
         return sys.platform == 'linux2' and not self.check_qpid_proton_version()
 
     def run(self):
-        prefix = None
         if self.bundle_proton:
-            prefix = self.bundle_libqpid_proton_extension()
+            self.bundle_libqpid_proton_extension()
 
-        self.set_cproton_settings(prefix)
+
+class CustomBuildOrder(build):
+    # The sole purpose of this class is to re-order
+    # the commands execution so that `build_ext` is executed *before*
+    # build_py. We need this to make sure `cproton.py` is generated
+    # before the python modules are collected. Otherwise, it won't
+    # be installed.
+    sub_commands = [
+        ('build_ext', build.has_ext_modules),
+        ('build_py', build.has_pure_modules),
+        ('build_clib', build.has_c_libraries),
+        ('build_scripts', build.has_scripts),
+    ]
+
+
+class CheckingBuildExt(build_ext):
+    """Subclass build_ext to build qpid-proton using `cmake`"""
+
+    def run(self):
+        # Discover qpid-proton in the system
+        self.distribution.run_command('configure')
+        build_ext.run(self)
 
 
-# NOTE(flaper87): Override `build_ext` and add `configure`
+# Override `build_ext` and add `configure`
 cmdclass = {'configure': Configure,
             'build': CustomBuildOrder,
             'build_ext': CheckingBuildExt}
@@ -219,4 +332,5 @@ setup(name='python-qpid-proton',
                    "Programming Language :: Python"],
       cmdclass = cmdclass,
       ext_modules=[Extension('_cproton', ['cproton.i'],
+                             swig_opts=['-threads'],
                              libraries=['qpid-proton'])])

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3db3cf17/proton-c/bindings/python/setuputils/bundle.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/setuputils/bundle.py b/proton-c/bindings/python/setuputils/bundle.py
index 920744d..13b88e0 100644
--- a/proton-c/bindings/python/setuputils/bundle.py
+++ b/proton-c/bindings/python/setuputils/bundle.py
@@ -32,10 +32,10 @@ from . import log
 #-----------------------------------------------------------------------------
 # Constants
 #-----------------------------------------------------------------------------
-min_qpid_proton = (0, 9)
+min_qpid_proton = (0, 10)
 min_qpid_proton_str = "%i.%i" % min_qpid_proton
 
-bundled_version = (0,9,1)
+bundled_version = (0, 10, 0)
 bundled_version_str = "%i.%i.%i" % bundled_version
 libqpid_proton = "qpid-proton-%s.tar.gz" % bundled_version_str
 libqpid_proton_url = ("http://www.apache.org/dist/qpid/proton/%s/%s" %

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3db3cf17/proton-c/bindings/python/setuputils/log.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/setuputils/log.py b/proton-c/bindings/python/setuputils/log.py
index 1e051d4..f11b255 100644
--- a/proton-c/bindings/python/setuputils/log.py
+++ b/proton-c/bindings/python/setuputils/log.py
@@ -26,7 +26,7 @@ if os.environ.get('DEBUG'):
     logger.setLevel(logging.DEBUG)
 else:
     logger.setLevel(logging.INFO)
-    logger.addHandler(logging.StreamHandler(sys.stderr))
+logger.addHandler(logging.StreamHandler(sys.stderr))
 
 
 def debug(msg):

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3db3cf17/proton-c/bindings/python/setuputils/misc.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/setuputils/misc.py b/proton-c/bindings/python/setuputils/misc.py
index 8978371..cf6b97f 100644
--- a/proton-c/bindings/python/setuputils/misc.py
+++ b/proton-c/bindings/python/setuputils/misc.py
@@ -19,89 +19,7 @@ import sys
 from . import log
 
 
-def settings_from_prefix(prefix=None):
-    """Load appropriate library/include settings from qpid-proton prefix
-
-    NOTE: Funcion adapted from PyZMQ, which is itself Modified BSD licensed.
-
-    :param prefix: The install prefix where the dependencies are expected to be
-    """
-    settings = {}
-    settings['libraries'] = []
-    settings['include_dirs'] = []
-    settings['library_dirs'] = []
-    settings['swig_opts'] = ['-threads']
-    settings['runtime_library_dirs'] = []
-    settings['extra_link_args'] = []
-
-    if sys.platform.startswith('win'):
-        settings['libraries'].append('libqpid-proton')
-
-        if prefix:
-            settings['include_dirs'] += [os.path.join(prefix, 'include')]
-            settings['library_dirs'] += [os.path.join(prefix, 'lib')]
-    else:
-
-        # If prefix is not explicitly set, pull it from pkg-config by default.
-
-        if not prefix:
-            try:
-                cmd = 'pkg-config --variable=prefix --print-errors libqpid-proton'.split()
-                p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-            except OSError as e:
-                if e.errno == errno.ENOENT:
-                    log.info("pkg-config not found")
-                else:
-                    log.warn("Running pkg-config failed - %s." % e)
-                p = None
-            if p is not None:
-                if p.wait():
-                    log.info("Did not find libqpid-proton via pkg-config:")
-                    log.info(p.stderr.read().decode())
-                else:
-                    prefix = p.stdout.readline().strip().decode()
-                    log.info("Using qpid-proton-prefix %s (found via pkg-config)." % prefix)
-
-        settings['libraries'].append('qpid-proton')
-        # add pthread on freebsd
-        if sys.platform.startswith('freebsd'):
-            settings['libraries'].append('pthread')
-
-        if sys.platform == 'sunos5':
-          if platform.architecture()[0] == '32bit':
-            settings['extra_link_args'] += ['-m32']
-          else:
-            settings['extra_link_args'] += ['-m64']
-        if prefix:
-            settings['include_dirs'] += [os.path.join(prefix, 'include')]
-            settings['library_dirs'] += [os.path.join(prefix, 'lib')]
-            settings['library_dirs'] += [os.path.join(prefix, 'lib64')]
-
-        else:
-            if sys.platform == 'darwin' and os.path.isdir('/opt/local/lib'):
-                # allow macports default
-                settings['include_dirs'] += ['/opt/local/include']
-                settings['library_dirs'] += ['/opt/local/lib']
-                settings['library_dirs'] += ['/opt/local/lib64']
-            if os.environ.get('VIRTUAL_ENV', None):
-                # find libqpid_proton installed in virtualenv
-                env = os.environ['VIRTUAL_ENV']
-                settings['include_dirs'] += [os.path.join(env, 'include')]
-                settings['library_dirs'] += [os.path.join(env, 'lib')]
-                settings['library_dirs'] += [os.path.join(env, 'lib64')]
-
-        if sys.platform != 'darwin':
-            settings['runtime_library_dirs'] += [
-                os.path.abspath(x) for x in settings['library_dirs']
-            ]
-
-    for d in settings['include_dirs']:
-        settings['swig_opts'] += ['-I' + d]
-
-    return settings
-
-
-def pkg_config_version(atleast=None, max_version=None):
+def pkg_config_version(atleast=None, max_version=None, module='libqpid-proton'):
     """Check the qpid_proton version using pkg-config
 
     This function returns True/False depending on whether
@@ -119,7 +37,7 @@ def pkg_config_version(atleast=None, max_version=None):
         cmd = ['pkg-config',
                '--%s-version=%s' % (atleast and 'atleast' or 'max',
                                     atleast or max_version),
-               'libqpid-proton']
+               module]
         p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     except OSError as e:
         if e.errno == errno.ENOENT:
@@ -133,5 +51,5 @@ def pkg_config_version(atleast=None, max_version=None):
         log.info(p.stderr.read().decode())
         return False
 
-    log.info("Using libqpid-proton (found via pkg-config).")
+    log.info("Using %s (found via pkg-config)." % module)
     return True

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3db3cf17/proton-c/bindings/python/tox.ini
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/tox.ini b/proton-c/bindings/python/tox.ini
new file mode 100644
index 0000000..aab5e4e
--- /dev/null
+++ b/proton-c/bindings/python/tox.ini
@@ -0,0 +1,36 @@
+[tox]
+envlist = build
+minversion = 1.4
+skipdist = True
+
+[testenv]
+changedir = {toxinidir}/../../proton-c/include/
+setenv =
+    VIRTUAL_ENV={envdir}
+passenv =
+    PKG_CONFIG_PATH
+    CFLAGS
+commands =
+    pip install -e {toxinidir}
+    tests/python/proton-test {posargs}
+
+[testenv:pep8]
+commands = flake8
+
+[testenv:docs]
+commands = python setup.py build_sphinx
+
+[testenv:build]
+usedevelop = False
+skipdist = True
+changedir = {toxinidir}
+platform = linux2
+skip_install = True
+setenv =
+    VIRTUAL_ENV={envdir}
+    PKG_CONFIG_PATH=None
+    QPID_PROTON_SRC={toxinidir}/../../../
+    DEBUG=True
+commands =
+    {envbindir}/python setup.py build -b {envbindir}/build install
+    {toxinidir}/../../../tests/python/proton-test {posargs}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3db3cf17/tests/python/proton_tests/common.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/common.py b/tests/python/proton_tests/common.py
index 1b8dbdb..83a39f8 100644
--- a/tests/python/proton_tests/common.py
+++ b/tests/python/proton_tests/common.py
@@ -219,14 +219,22 @@ class MessengerApp(object):
                     foundfile = self.findfile(cmd[0], os.environ['PATH'])
                     if foundfile is None:
                         foundfile = self.findfile(cmd[0], os.environ['PYTHONPATH'])
-                        assert foundfile is not None, "Unable to locate file '%s' in PATH or PYTHONPATH" % cmd[0]
+                        msg = "Unable to locate file '%s' in PATH or PYTHONPATH" % cmd[0]
+                        raise Skipped("Skipping test - %s" % msg)
+
                     del cmd[0:1]
                     cmd.insert(0, foundfile)
                     cmd.insert(0, sys.executable)
             self._process = Popen(cmd, stdout=PIPE, stderr=STDOUT, bufsize=4096)
         except OSError, e:
             print("ERROR: '%s'" % e)
-            assert False, "Unable to execute command '%s', is it in your PATH?" % cmd[0]
+            msg = "Unable to execute command '%s', is it in your PATH?" % cmd[0]
+
+            # NOTE(flaper87): Skip the test if the command is not found.
+            if e.errno == 2:
+              raise Skipped("Skipping test - %s" % msg)
+            assert False, msg
+
         self._ready()  # wait for it to initialize
 
     def stop(self):


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


[33/50] [abbrv] qpid-proton git commit: PROTON-914: Fix for getting the SSL peer hostname in Ruby.

Posted by kg...@apache.org.
PROTON-914: Fix for getting the SSL peer hostname in Ruby.

Previously the call was returning the result code rather than the actual
hostname value.


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

Branch: refs/heads/kgiusti-python3
Commit: cbb6800496e88a0a4f22523c0f0f68afd3424323
Parents: 0f90a7e
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Wed Jun 17 11:12:32 2015 -0400
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Wed Jun 17 11:51:40 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/core/ssl.rb       | 18 +++++++++++-------
 proton-c/bindings/ruby/lib/core/transport.rb |  5 ++---
 proton-c/bindings/ruby/ruby.i                | 13 +------------
 3 files changed, 14 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cbb68004/proton-c/bindings/ruby/lib/core/ssl.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/ssl.rb b/proton-c/bindings/ruby/lib/core/ssl.rb
index 9c4a3e9..0b16075 100644
--- a/proton-c/bindings/ruby/lib/core/ssl.rb
+++ b/proton-c/bindings/ruby/lib/core/ssl.rb
@@ -66,11 +66,6 @@ module Qpid::Proton
     # @private
     PROTON_METHOD_PREFIX = "pn_ssl"
 
-    # @!attribute peer_hostname
-    #
-    # @return [String] The peer hostname.
-    proton_accessor :peer_hostname
-
     # @private
     include Util::ErrorHandler
 
@@ -108,10 +103,10 @@ module Qpid::Proton
 
     def initialize(impl, domain, session_details, session_id)
       @impl = impl
-      @domain = domain
+      @domain = domain.impl unless domain.nil?
       @session_details = session_details
       @session_id = session_id
-      Cproton.pn_ssl_init(@impl, @domain.impl, @session_id)
+      Cproton.pn_ssl_init(@impl, @domain, @session_id)
     end
 
     public
@@ -155,6 +150,15 @@ module Qpid::Proton
       Cproton.pn_ssl_resume_status(@impl)
     end
 
+    # Gets the peer hostname.
+    #
+    # @return [String] The peer hostname.
+    def peer_hostname
+      (error, name) = Cproton.pn_ssl_get_peer_hostname(@impl, 1024)
+      raise SSLError.new if error < 0
+      return name
+    end
+
   end
 
 end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cbb68004/proton-c/bindings/ruby/lib/core/transport.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/transport.rb b/proton-c/bindings/ruby/lib/core/transport.rb
index 206f97d..9ba5dc8 100644
--- a/proton-c/bindings/ruby/lib/core/transport.rb
+++ b/proton-c/bindings/ruby/lib/core/transport.rb
@@ -398,13 +398,12 @@ module Qpid::Proton
     # @return [SSL] The SSL object.
     #
     def ssl(domain = nil, session_details = nil)
-      self.ssl = SSL.create(self, domain, session_details) if self.ssl.nil?
-      self.ssl
+      @ssl ||= SSL.create(self, domain, session_details) if @ssl.nil?
     end
 
     # @private
     def ssl?
-      self.respond_to?(:ssl) && !self.ssl.nil?
+      !@ssl.nil?
     end
 
   end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cbb68004/proton-c/bindings/ruby/ruby.i
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/ruby.i b/proton-c/bindings/ruby/ruby.i
index 0534808..678a085 100644
--- a/proton-c/bindings/ruby/ruby.i
+++ b/proton-c/bindings/ruby/ruby.i
@@ -556,18 +556,7 @@ VALUE pni_address_of(void *object) {
 //  %}
 //%ignore pn_collector_put;
 
-%rename(pn_ssl_get_peer_hostname) wrap_pn_ssl_get_peer_hostname;
-%inline %{
-  int wrap_pn_ssl_get_peer_hostname(pn_ssl_t *ssl, char *OUTPUT, size_t *OUTPUT_SIZE) {
-    ssize_t size = pn_ssl_get_peer_hostname(ssl, OUTPUT, *OUTPUT_SIZE);
-    if (size >= 0) {
-      *OUTPUT_SIZE = size;
-    } else {
-      *OUTPUT_SIZE = 0;
-    }
-    return size;
-  }
-  %}
+int pn_ssl_get_peer_hostname(pn_ssl_t *ssl, char *OUTPUT, size_t *OUTPUT_SIZE);
 %ignore pn_ssl_get_peer_hostname;
 
 %include "proton/cproton.i"


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


[31/50] [abbrv] qpid-proton git commit: PROTON-909: Rearrange the test code to create the Cyrus SASL configuration - Make the Cyrus SASL configuration global for all the testing - This fixes test failures against earlier versions of the Cyrus library - T

Posted by kg...@apache.org.
PROTON-909: Rearrange the test code to create the Cyrus SASL configuration
- Make the Cyrus SASL configuration global for all the testing
- This fixes test failures against earlier versions of the Cyrus library
- The bug this fixes relates to PROTON-862


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

Branch: refs/heads/kgiusti-python3
Commit: 0f90a7e4c9cc5a1decd7f6896c16d9b8b0653316
Parents: 56af118
Author: Andrew Stitcher <as...@apache.org>
Authored: Tue Jun 16 14:25:16 2015 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Jun 16 14:54:13 2015 -0400

----------------------------------------------------------------------
 tests/python/proton_tests/common.py | 28 +++++++++++++++++++++-
 tests/python/proton_tests/sasl.py   | 40 --------------------------------
 2 files changed, 27 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0f90a7e4/tests/python/proton_tests/common.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/common.py b/tests/python/proton_tests/common.py
index 83a39f8..11bea85 100644
--- a/tests/python/proton_tests/common.py
+++ b/tests/python/proton_tests/common.py
@@ -22,10 +22,11 @@ from random import randint
 from threading import Thread
 from socket import socket, AF_INET, SOCK_STREAM
 from subprocess import Popen,PIPE,STDOUT
-import sys, os, string
+import sys, os, string, subprocess
 from proton import Connection, Transport, SASL, Endpoint, Delivery, SSL
 from proton.reactor import Container
 from proton.handlers import CHandshaker, CFlowController
+from string import Template
 
 
 def free_tcp_ports(count=1):
@@ -86,6 +87,31 @@ def pump(transport1, transport2, buffer_size=1024):
 def isSSLPresent():
     return SSL.present()
 
+def _cyrusSetup(conf_dir):
+  """Write out simple SASL config.
+     This assumes saslpasswd2 is in the OS path.
+  """
+  t = Template("""sasldb_path: ${db}
+mech_list: EXTERNAL DIGEST-MD5 SCRAM-SHA-1 CRAM-MD5 PLAIN ANONYMOUS
+""")
+  abs_conf_dir = os.path.abspath(conf_dir)
+  subprocess.call(args=['rm','-rf',abs_conf_dir])
+  os.mkdir(abs_conf_dir)
+  db = os.path.join(abs_conf_dir,'proton.sasldb')
+  conf = os.path.join(abs_conf_dir,'proton-server.conf')
+  f = open(conf, 'w')
+  f.write(t.substitute(db=db))
+  f.close()
+
+  cmd = Template("echo password | saslpasswd2 -c -p -f ${db} -u proton user").substitute(db=db)
+  subprocess.call(args=cmd, shell=True)
+
+  os.environ['PN_SASL_CONFIG_PATH'] = abs_conf_dir
+
+# Globally initialize Cyrus SASL configuration
+if SASL.extended():
+  _cyrusSetup('sasl_conf')
+
 class Test(TestCase):
 
   def __init__(self, name):

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0f90a7e4/tests/python/proton_tests/sasl.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/sasl.py b/tests/python/proton_tests/sasl.py
index 91b3e69..7f1e7ad 100644
--- a/tests/python/proton_tests/sasl.py
+++ b/tests/python/proton_tests/sasl.py
@@ -18,8 +18,6 @@
 #
 
 import sys, os, common
-from string import Template
-import subprocess
 
 from proton import *
 from common import pump, Skipped
@@ -32,23 +30,6 @@ def _sslCertpath(file):
     return os.path.join(os.path.dirname(__file__),
                         "ssl_db/%s" % file)
 
-def _cyrusSetup(conf_dir):
-  """Write out simple SASL config
-  """
-  t = Template("""sasldb_path: ${db}
-mech_list: EXTERNAL DIGEST-MD5 SCRAM-SHA-1 CRAM-MD5 PLAIN ANONYMOUS
-""")
-  subprocess.call(args=['rm','-rf',conf_dir])
-  os.mkdir(conf_dir)
-  db = os.path.abspath(os.path.join(conf_dir,'proton.sasldb'))
-  conf = os.path.abspath(os.path.join(conf_dir,'proton.conf'))
-  f = open(conf, 'w')
-  f.write(t.substitute(db=db))
-  f.close()
-
-  cmd = Template("echo password | saslpasswd2 -c -p -f ${db} -u proton user").substitute(db=db)
-  subprocess.call(args=cmd, shell=True)
-
 def _testSaslMech(self, mech, clientUser='user@proton', authUser='user@proton', encrypted=False, authenticated=True):
   self.s1.allowed_mechs(mech)
   self.c1.open()
@@ -92,13 +73,6 @@ class SaslTest(Test):
     self.t2 = Transport(Transport.SERVER)
     self.s2 = SASL(self.t2)
 
-    if not SASL.extended():
-      return
-
-    _cyrusSetup('sasl_conf')
-    self.s2.config_name('proton')
-    self.s2.config_path(os.path.abspath('sasl_conf'))
-
   def pump(self):
     pump(self.t1, self.t2, 1024)
 
@@ -325,13 +299,6 @@ class CyrusSASLTest(Test):
     self.c1.password = 'password'
     self.c1.hostname = 'localhost'
 
-    if not SASL.extended():
-      return
-
-    _cyrusSetup('sasl_conf')
-    self.s2.config_name('proton')
-    self.s2.config_path(os.path.abspath('sasl_conf'))
-
   def testMechANON(self):
     self.t1.bind(self.c1)
     _testSaslMech(self, 'ANONYMOUS', authUser='anonymous')
@@ -380,13 +347,6 @@ class SSLSASLTest(Test):
 
     self.c1 = Connection()
 
-    if not SASL.extended():
-      return
-
-    _cyrusSetup('sasl_conf')
-    self.s2.config_name('proton')
-    self.s2.config_path(os.path.abspath('sasl_conf'))
-
   def testSSLPlainSimple(self):
     if "java" in sys.platform:
       raise Skipped("Proton-J does not support SSL with SASL")


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


[34/50] [abbrv] qpid-proton git commit: PROTON-917: avoid buffer underrun if no mechs given

Posted by kg...@apache.org.
PROTON-917: avoid buffer underrun if no mechs given


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

Branch: refs/heads/kgiusti-python3
Commit: 718d8b37644ab9102364ce8e23ee47b029191556
Parents: cbb6800
Author: Ken Giusti <kg...@apache.org>
Authored: Wed Jun 17 14:47:29 2015 -0400
Committer: Ken Giusti <kg...@apache.org>
Committed: Wed Jun 17 14:49:58 2015 -0400

----------------------------------------------------------------------
 proton-c/src/sasl/sasl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/718d8b37/proton-c/src/sasl/sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/sasl.c b/proton-c/src/sasl/sasl.c
index 3142832..c339ea9 100644
--- a/proton-c/src/sasl/sasl.c
+++ b/proton-c/src/sasl/sasl.c
@@ -586,7 +586,10 @@ int pn_do_mechanisms(pn_transport_t *transport, uint8_t frame_type, uint16_t cha
       pn_string_addf(mechs, "%*s ", (int)s.size, s.start);
     }
   }
-  pn_string_buffer(mechs)[pn_string_size(mechs)-1] = 0;
+
+  if (pn_string_size(mechs)) {
+      pn_string_buffer(mechs)[pn_string_size(mechs)-1] = 0;
+  }
 
   if (pni_init_client(transport) &&
       pni_process_mechanisms(transport, pn_string_get(mechs))) {


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


[13/50] [abbrv] qpid-proton git commit: NO-JIRA: don't fail install if docs haven't been generated (tutorial in particular)

Posted by kg...@apache.org.
NO-JIRA: don't fail install if docs haven't been generated (tutorial in particular)


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

Branch: refs/heads/kgiusti-python3
Commit: aa548c40b52af58809d98c5243e5cb1fdaad1d56
Parents: 53b9184
Author: Gordon Sim <gs...@redhat.com>
Authored: Tue Jun 9 16:35:55 2015 +0100
Committer: Gordon Sim <gs...@redhat.com>
Committed: Tue Jun 9 16:35:55 2015 +0100

----------------------------------------------------------------------
 proton-c/bindings/python/CMakeLists.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/aa548c40/proton-c/bindings/python/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/CMakeLists.txt b/proton-c/bindings/python/CMakeLists.txt
index 4f15aac..26fa171 100644
--- a/proton-c/bindings/python/CMakeLists.txt
+++ b/proton-c/bindings/python/CMakeLists.txt
@@ -103,7 +103,8 @@ if (SPHINX_EXE)
    add_dependencies(docs tutorial-py)
    install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/tutorial/"
            DESTINATION "${PROTON_SHARE}/docs/tutorial-py"
-           COMPONENT documentation)
+           COMPONENT documentation
+           ${OPTIONAL_ARG})
 endif (SPHINX_EXE)
 
 install(FILES ${CPROTON_ARTIFACTS}


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


[30/50] [abbrv] qpid-proton git commit: PROTON-908: Remove install-runtime dependency on swig

Posted by kg...@apache.org.
PROTON-908: Remove install-runtime dependency on swig

The patch allows python-qpid-proton for generating the `cproton_wrap.c`
file when creating the distribution package. Since this file is already
cross-platform, it should be safe to ship it as part of the
python-qpid-proton package.

This allows us for building the bindings even when swig is not
available. The setup.py process will try to generate a new
cproton_wrap.c everytime but it'll fallback to the one distributed with
the package if swig is not available.

Note that this will be done just in the platforms where bundling
proton-c is supported. The reason being that, in the other platforms, w
can't verify whether the installed qpid-proton version is the same that
was used to generated these files


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

Branch: refs/heads/kgiusti-python3
Commit: 56af1189cf2e6a769b0452a102a795a6f906b470
Parents: 821b4e1
Author: Flavio Percoco <fl...@gmail.com>
Authored: Thu Jun 11 10:24:36 2015 +0200
Committer: Ken Giusti <kg...@apache.org>
Committed: Tue Jun 16 13:06:46 2015 -0400

----------------------------------------------------------------------
 proton-c/CMakeLists.txt           |  2 +-
 proton-c/bindings/python/setup.py | 58 +++++++++++++++++++++++++++++++---
 2 files changed, 54 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56af1189/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index 5b05e38..5985e2d 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -520,7 +520,7 @@ if (BUILD_PYTHON)
          to_native_path ("${py_pythonpath}" py_pythonpath)
          add_test (NAME python-tox-test
                    COMMAND ${env_py}
-		   "PATH=${py_path}" ${VALGRIND_ENV}
+		   "PATH=${py_path}" "QPID_PROTON_SRC=${CMAKE_CURRENT_SOURCE_DIR}/../" ${VALGRIND_ENV}
                    tox
 		   WORKING_DIRECTORY ${py_src})
          set_tests_properties(python-tox-test PROPERTIES PASS_REGULAR_EXPRESSION "Totals: .* 0 failed")

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56af1189/proton-c/bindings/python/setup.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/setup.py b/proton-c/bindings/python/setup.py
index 84b5a66..0a77872 100755
--- a/proton-c/bindings/python/setup.py
+++ b/proton-c/bindings/python/setup.py
@@ -78,12 +78,32 @@ from distutils.ccompiler import new_compiler, get_default_compiler
 from distutils.core import setup, Extension
 from distutils.command.build import build
 from distutils.command.build_ext import build_ext
+from distutils.command.sdist import sdist
+from distutils import errors
 
 from setuputils import bundle
 from setuputils import log
 from setuputils import misc
 
 
+class CheckSDist(sdist):
+
+    def run(self):
+        self.distribution.run_command('configure')
+
+        # Append the source that was removed during
+        # the configuration step.
+        _cproton = self.distribution.ext_modules[-1]
+        _cproton.sources.append('cproton.i')
+
+        try:
+            sdist.run(self)
+        finally:
+            for src in ['cproton.py', 'cproton_wrap.c']:
+                if os.path.exists(src):
+                    os.remove(src)
+
+
 class Configure(build_ext):
     description = "Discover Qpid Proton version"
 
@@ -97,6 +117,21 @@ class Configure(build_ext):
         else:
             return compiler.compiler_type
 
+    def prepare_swig_wrap(self):
+        ext = self.distribution.ext_modules[-1]
+
+        try:
+            # This will actually call swig to generate the files
+            # and list the sources.
+            self.swig_sources(ext.sources, ext)
+        except (errors.DistutilsExecError, errors.DistutilsPlatformError) as e:
+            if not (os.path.exists('cproton_wrap.c') or
+                    os.path.exists('cproton.py')):
+                raise e
+
+        ext.sources = ext.sources[1:]
+        ext.swig_opts = []
+
     def bundle_libqpid_proton_extension(self):
         base = self.get_finalized_command('build').build_base
         build_include = os.path.join(base, 'include')
@@ -262,6 +297,7 @@ class Configure(build_ext):
         _cproton = self.distribution.ext_modules[-1]
         _cproton.library_dirs.append(self.build_lib)
         _cproton.include_dirs.append(proton_include)
+        _cproton.include_dirs.append(build_include)
         _cproton.include_dirs.append(os.path.join(proton_src, 'bindings', 'python'))
 
         _cproton.swig_opts.append('-I%s' % build_include)
@@ -283,11 +319,20 @@ class Configure(build_ext):
     @property
     def bundle_proton(self):
         """Bundled proton if the conditions below are met."""
-        return sys.platform == 'linux2' and not self.check_qpid_proton_version()
+        return not self.check_qpid_proton_version()
 
     def run(self):
-        if self.bundle_proton:
-            self.bundle_libqpid_proton_extension()
+        if sys.platform == 'linux2':
+            if self.bundle_proton:
+                self.bundle_libqpid_proton_extension()
+
+            # Do this just on linux since it's the only
+            # platform we support building the bundle for
+            # and especially, it's the only platform we check
+            # the, hopefully installed, qpid-proton version.
+            # This avoids re-using the distributed wrappers with
+            # uncompatible versions.
+            self.prepare_swig_wrap()
 
 
 class CustomBuildOrder(build):
@@ -316,7 +361,8 @@ class CheckingBuildExt(build_ext):
 # Override `build_ext` and add `configure`
 cmdclass = {'configure': Configure,
             'build': CustomBuildOrder,
-            'build_ext': CheckingBuildExt}
+            'build_ext': CheckingBuildExt,
+            'sdist': CheckSDist}
 
 
 setup(name='python-qpid-proton',
@@ -332,6 +378,8 @@ setup(name='python-qpid-proton',
                    "Intended Audience :: Developers",
                    "Programming Language :: Python"],
       cmdclass = cmdclass,
-      ext_modules=[Extension('_cproton', ['cproton.i'],
+      ext_modules=[Extension('_cproton',
+                             sources=['cproton.i', 'cproton_wrap.c'],
                              swig_opts=['-threads'],
+                             extra_compile_args=['-pthread'],
                              libraries=['qpid-proton'])])


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


[09/50] [abbrv] qpid-proton git commit: PROTON-896: declare functions static that are only referred to in one file, and change their names to have pni_ prefix.

Posted by kg...@apache.org.
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d921c6bc/proton-c/src/transport/transport.c
----------------------------------------------------------------------
diff --git a/proton-c/src/transport/transport.c b/proton-c/src/transport/transport.c
index e72875b..b5887ef 100644
--- a/proton-c/src/transport/transport.c
+++ b/proton-c/src/transport/transport.c
@@ -54,7 +54,7 @@ void pn_delivery_map_free(pn_delivery_map_t *db)
   pn_free(db->deliveries);
 }
 
-pn_delivery_t *pn_delivery_map_get(pn_delivery_map_t *db, pn_sequence_t id)
+static pn_delivery_t *pni_delivery_map_get(pn_delivery_map_t *db, pn_sequence_t id)
 {
   return (pn_delivery_t *) pn_hash_get(db->deliveries, id);
 }
@@ -66,7 +66,7 @@ static void pn_delivery_state_init(pn_delivery_state_t *ds, pn_delivery_t *deliv
   ds->init = true;
 }
 
-pn_delivery_state_t *pn_delivery_map_push(pn_delivery_map_t *db, pn_delivery_t *delivery)
+static pn_delivery_state_t *pni_delivery_map_push(pn_delivery_map_t *db, pn_delivery_t *delivery)
 {
   pn_delivery_state_t *ds = &delivery->state;
   pn_delivery_state_init(ds, delivery, db->next++);
@@ -83,7 +83,7 @@ void pn_delivery_map_del(pn_delivery_map_t *db, pn_delivery_t *delivery)
   }
 }
 
-void pn_delivery_map_clear(pn_delivery_map_t *dm)
+static void pni_delivery_map_clear(pn_delivery_map_t *dm)
 {
   pn_hash_t *hash = dm->deliveries;
   for (pn_handle_t entry = pn_hash_head(hash);
@@ -405,7 +405,7 @@ static void pn_transport_initialize(void *object)
 }
 
 
-pn_session_t *pn_channel_state(pn_transport_t *transport, uint16_t channel)
+static pn_session_t *pni_channel_state(pn_transport_t *transport, uint16_t channel)
 {
   return (pn_session_t *) pn_hash_get(transport->remote_channels, channel);
 }
@@ -423,7 +423,7 @@ void pni_transport_unbind_handles(pn_hash_t *handles, bool reset_state);
 static void pni_unmap_remote_channel(pn_session_t *ssn)
 {
   // XXX: should really update link state also
-  pn_delivery_map_clear(&ssn->state.incoming);
+  pni_delivery_map_clear(&ssn->state.incoming);
   pni_transport_unbind_handles(ssn->state.remote_handles, false);
   pn_transport_t *transport = ssn->connection->transport;
   uint16_t channel = ssn->state.remote_channel;
@@ -637,8 +637,8 @@ void pni_transport_unbind_channels(pn_hash_t *channels)
   for (pn_handle_t h = pn_hash_head(channels); h; h = pn_hash_next(channels, h)) {
     uintptr_t key = pn_hash_key(channels, h);
     pn_session_t *ssn = (pn_session_t *) pn_hash_value(channels, h);
-    pn_delivery_map_clear(&ssn->state.incoming);
-    pn_delivery_map_clear(&ssn->state.outgoing);
+    pni_delivery_map_clear(&ssn->state.incoming);
+    pni_delivery_map_clear(&ssn->state.outgoing);
     pni_transport_unbind_handles(ssn->state.local_handles, true);
     pni_transport_unbind_handles(ssn->state.remote_handles, true);
     pn_session_unbound(ssn);
@@ -662,8 +662,8 @@ int pn_transport_unbind(pn_transport_t *transport)
   // XXX: what happens if the endpoints are freed before we get here?
   pn_session_t *ssn = pn_session_head(conn, 0);
   while (ssn) {
-    pn_delivery_map_clear(&ssn->state.incoming);
-    pn_delivery_map_clear(&ssn->state.outgoing);
+    pni_delivery_map_clear(&ssn->state.incoming);
+    pni_delivery_map_clear(&ssn->state.outgoing);
     ssn = pn_session_next(ssn, 0);
   }
 
@@ -721,7 +721,7 @@ static void pni_unmap_remote_handle(pn_link_t *link)
   pn_hash_del(link->session->state.remote_handles, handle);
 }
 
-pn_link_t *pn_handle_state(pn_session_t *ssn, uint32_t handle)
+static pn_link_t *pni_handle_state(pn_session_t *ssn, uint32_t handle)
 {
   return (pn_link_t *) pn_hash_get(ssn->state.remote_handles, handle);
 }
@@ -849,17 +849,17 @@ int pn_post_frame(pn_transport_t *transport, uint8_t type, uint16_t ch, const ch
   return 0;
 }
 
-int pn_post_amqp_transfer_frame(pn_transport_t *transport, uint16_t ch,
-                                uint32_t handle,
-                                pn_sequence_t id,
-                                pn_bytes_t *payload,
-                                const pn_bytes_t *tag,
-                                uint32_t message_format,
-                                bool settled,
-                                bool more,
-                                pn_sequence_t frame_limit,
-                                uint64_t code,
-                                pn_data_t* state)
+static int pni_post_amqp_transfer_frame(pn_transport_t *transport, uint16_t ch,
+                                        uint32_t handle,
+                                        pn_sequence_t id,
+                                        pn_bytes_t *payload,
+                                        const pn_bytes_t *tag,
+                                        uint32_t message_format,
+                                        bool settled,
+                                        bool more,
+                                        pn_sequence_t frame_limit,
+                                        uint64_t code,
+                                        pn_data_t* state)
 {
   bool more_flag = more;
   int framecount = 0;
@@ -952,7 +952,7 @@ int pn_post_amqp_transfer_frame(pn_transport_t *transport, uint16_t ch,
   return framecount;
 }
 
-int pn_post_close(pn_transport_t *transport, const char *condition, const char *description)
+static int pni_post_close(pn_transport_t *transport, const char *condition, const char *description)
 {
   pn_condition_t *cond = NULL;
   if (transport->connection) {
@@ -1013,7 +1013,7 @@ int pn_do_error(pn_transport_t *transport, const char *condition, const char *fm
       pn_post_frame(transport, AMQP_FRAME_TYPE, 0, "DL[S]", OPEN, "");
     }
 
-    pn_post_close(transport, condition, buf);
+    pni_post_close(transport, condition, buf);
     transport->close_sent = true;
   }
   transport->halt = true;
@@ -1213,7 +1213,7 @@ int pn_do_attach(pn_transport_t *transport, uint8_t frame_type, uint16_t channel
   strncpy(strname, name.start, name.size);
   strname[name.size] = '\0';
 
-  pn_session_t *ssn = pn_channel_state(transport, channel);
+  pn_session_t *ssn = pni_channel_state(transport, channel);
   if (!ssn) {
       pn_do_error(transport, "amqp:connection:no-session", "attach without a session");
       if (strheap) free(strheap);
@@ -1303,7 +1303,7 @@ int pn_do_attach(pn_transport_t *transport, uint8_t frame_type, uint16_t channel
   return 0;
 }
 
-int pn_post_flow(pn_transport_t *transport, pn_session_t *ssn, pn_link_t *link);
+static int pni_post_flow(pn_transport_t *transport, pn_session_t *ssn, pn_link_t *link);
 
 // free the delivery
 static void pn_full_settle(pn_delivery_map_t *db, pn_delivery_t *delivery)
@@ -1330,13 +1330,13 @@ int pn_do_transfer(pn_transport_t *transport, uint8_t frame_type, uint16_t chann
   int err = pn_data_scan(args, "D.[I?Iz.oo.D?LC]", &handle, &id_present, &id, &tag,
                          &settled, &more, &has_type, &type, transport->disp_data);
   if (err) return err;
-  pn_session_t *ssn = pn_channel_state(transport, channel);
+  pn_session_t *ssn = pni_channel_state(transport, channel);
 
   if (!ssn->state.incoming_window) {
     return pn_do_error(transport, "amqp:session:window-violation", "incoming session window exceeded");
   }
 
-  pn_link_t *link = pn_handle_state(ssn, handle);
+  pn_link_t *link = pni_handle_state(ssn, handle);
   pn_delivery_t *delivery;
   if (link->unsettled_tail && !link->unsettled_tail->done) {
     delivery = link->unsettled_tail;
@@ -1350,7 +1350,7 @@ int pn_do_transfer(pn_transport_t *transport, uint8_t frame_type, uint16_t chann
     }
 
     delivery = pn_delivery(link, pn_dtag(tag.start, tag.size));
-    pn_delivery_state_t *state = pn_delivery_map_push(incoming, delivery);
+    pn_delivery_state_t *state = pni_delivery_map_push(incoming, delivery);
     if (id_present && id != state->id) {
       return pn_do_error(transport, "amqp:session:invalid-field",
                          "sequencing error, expected delivery-id %u, got %u",
@@ -1382,7 +1382,7 @@ int pn_do_transfer(pn_transport_t *transport, uint8_t frame_type, uint16_t chann
 
   // XXX: need better policy for when to refresh window
   if (!ssn->state.incoming_window && (int32_t) link->state.local_handle >= 0) {
-    pn_post_flow(transport, ssn, link);
+    pni_post_flow(transport, ssn, link);
   }
 
   pn_collector_put(transport->connection->collector, PN_OBJECT, delivery, PN_DELIVERY);
@@ -1400,7 +1400,7 @@ int pn_do_flow(pn_transport_t *transport, uint8_t frame_type, uint16_t channel,
                          &delivery_count, &link_credit, &drain);
   if (err) return err;
 
-  pn_session_t *ssn = pn_channel_state(transport, channel);
+  pn_session_t *ssn = pni_channel_state(transport, channel);
 
   if (inext_init) {
     ssn->state.remote_incoming_window = inext + iwin - ssn->state.outgoing_transfer_count;
@@ -1409,7 +1409,7 @@ int pn_do_flow(pn_transport_t *transport, uint8_t frame_type, uint16_t channel,
   }
 
   if (handle_init) {
-    pn_link_t *link = pn_handle_state(ssn, handle);
+    pn_link_t *link = pni_handle_state(ssn, handle);
     if (link->endpoint.type == SENDER) {
       pn_sequence_t receiver_count;
       if (dcount_init) {
@@ -1470,7 +1470,7 @@ int pn_do_disposition(pn_transport_t *transport, uint8_t frame_type, uint16_t ch
   if (err) return err;
   if (!last_init) last = first;
 
-  pn_session_t *ssn = pn_channel_state(transport, channel);
+  pn_session_t *ssn = pni_channel_state(transport, channel);
   pn_delivery_map_t *deliveries;
   if (role) {
     deliveries = &ssn->state.outgoing;
@@ -1483,7 +1483,7 @@ int pn_do_disposition(pn_transport_t *transport, uint8_t frame_type, uint16_t ch
                       pn_data_get_list(transport->disp_data) > 0);
 
   for (pn_sequence_t id = first; id <= last; id++) {
-    pn_delivery_t *delivery = pn_delivery_map_get(deliveries, id);
+    pn_delivery_t *delivery = pni_delivery_map_get(deliveries, id);
     pn_disposition_t *remote = &delivery->remote;
     if (delivery) {
       if (type_init) remote->type = type;
@@ -1542,11 +1542,11 @@ int pn_do_detach(pn_transport_t *transport, uint8_t frame_type, uint16_t channel
   int err = pn_data_scan(args, "D.[Io]", &handle, &closed);
   if (err) return err;
 
-  pn_session_t *ssn = pn_channel_state(transport, channel);
+  pn_session_t *ssn = pni_channel_state(transport, channel);
   if (!ssn) {
     return pn_do_error(transport, "amqp:invalid-field", "no such channel: %u", channel);
   }
-  pn_link_t *link = pn_handle_state(ssn, handle);
+  pn_link_t *link = pni_handle_state(ssn, handle);
   if (!link) {
     return pn_do_error(transport, "amqp:invalid-field", "no such handle: %u", handle);
   }
@@ -1568,7 +1568,7 @@ int pn_do_detach(pn_transport_t *transport, uint8_t frame_type, uint16_t channel
 
 int pn_do_end(pn_transport_t *transport, uint8_t frame_type, uint16_t channel, pn_data_t *args, const pn_bytes_t *payload)
 {
-  pn_session_t *ssn = pn_channel_state(transport, channel);
+  pn_session_t *ssn = pni_channel_state(transport, channel);
   int err = pn_scan_error(args, &ssn->endpoint.remote_condition, SCAN_ERROR_DEFAULT);
   if (err) return err;
   PN_SET_REMOTE(ssn->endpoint.state, PN_REMOTE_CLOSED);
@@ -1753,7 +1753,7 @@ static pn_timestamp_t pn_tick_amqp(pn_transport_t* transport, unsigned int layer
   return timeout;
 }
 
-int pn_process_conn_setup(pn_transport_t *transport, pn_endpoint_t *endpoint)
+static int pni_process_conn_setup(pn_transport_t *transport, pn_endpoint_t *endpoint)
 {
   if (endpoint->type == CONNECTION)
   {
@@ -1796,7 +1796,7 @@ static uint16_t allocate_alias(pn_hash_t *aliases)
   return 0;
 }
 
-size_t pn_session_outgoing_window(pn_session_t *ssn)
+static size_t pni_session_outgoing_window(pn_session_t *ssn)
 {
   uint32_t size = ssn->connection->transport->remote_max_frame;
   if (!size) {
@@ -1810,7 +1810,7 @@ size_t pn_session_outgoing_window(pn_session_t *ssn)
   }
 }
 
-size_t pn_session_incoming_window(pn_session_t *ssn)
+static size_t pni_session_incoming_window(pn_session_t *ssn)
 {
   uint32_t size = ssn->connection->transport->local_max_frame;
   if (!size) {
@@ -1830,7 +1830,7 @@ static void pni_map_local_channel(pn_session_t *ssn)
   pn_ep_incref(&ssn->endpoint);
 }
 
-int pn_process_ssn_setup(pn_transport_t *transport, pn_endpoint_t *endpoint)
+static int pni_process_ssn_setup(pn_transport_t *transport, pn_endpoint_t *endpoint)
 {
   if (endpoint->type == SESSION && transport->open_sent)
   {
@@ -1839,8 +1839,8 @@ int pn_process_ssn_setup(pn_transport_t *transport, pn_endpoint_t *endpoint)
     if (!(endpoint->state & PN_LOCAL_UNINIT) && state->local_channel == (uint16_t) -1)
     {
       pni_map_local_channel(ssn);
-      state->incoming_window = pn_session_incoming_window(ssn);
-      state->outgoing_window = pn_session_outgoing_window(ssn);
+      state->incoming_window = pni_session_incoming_window(ssn);
+      state->outgoing_window = pni_session_outgoing_window(ssn);
       pn_post_frame(transport, AMQP_FRAME_TYPE, state->local_channel, "DL[?HIII]", BEGIN,
                     ((int16_t) state->remote_channel >= 0), state->remote_channel,
                     state->outgoing_transfer_count,
@@ -1876,7 +1876,7 @@ static void pni_map_local_handle(pn_link_t *link) {
   pn_ep_incref(&link->endpoint);
 }
 
-int pn_process_link_setup(pn_transport_t *transport, pn_endpoint_t *endpoint)
+static int pni_process_link_setup(pn_transport_t *transport, pn_endpoint_t *endpoint)
 {
   if (transport->open_sent && (endpoint->type == SENDER ||
                                endpoint->type == RECEIVER))
@@ -1947,10 +1947,10 @@ int pn_process_link_setup(pn_transport_t *transport, pn_endpoint_t *endpoint)
   return 0;
 }
 
-int pn_post_flow(pn_transport_t *transport, pn_session_t *ssn, pn_link_t *link)
+static int pni_post_flow(pn_transport_t *transport, pn_session_t *ssn, pn_link_t *link)
 {
-  ssn->state.incoming_window = pn_session_incoming_window(ssn);
-  ssn->state.outgoing_window = pn_session_outgoing_window(ssn);
+  ssn->state.incoming_window = pni_session_incoming_window(ssn);
+  ssn->state.outgoing_window = pni_session_outgoing_window(ssn);
   bool linkq = (bool) link;
   pn_link_state_t *state = &link->state;
   return pn_post_frame(transport, AMQP_FRAME_TYPE, ssn->state.local_channel, "DL[?IIII?I?I?In?o]", FLOW,
@@ -1964,7 +1964,7 @@ int pn_post_flow(pn_transport_t *transport, pn_session_t *ssn, pn_link_t *link)
                        linkq, linkq ? link->drain : false);
 }
 
-int pn_process_flow_receiver(pn_transport_t *transport, pn_endpoint_t *endpoint)
+static int pni_process_flow_receiver(pn_transport_t *transport, pn_endpoint_t *endpoint)
 {
   if (endpoint->type == RECEIVER && endpoint->state & PN_LOCAL_ACTIVE)
   {
@@ -1975,14 +1975,14 @@ int pn_process_flow_receiver(pn_transport_t *transport, pn_endpoint_t *endpoint)
         (int32_t) state->local_handle >= 0 &&
         ((rcv->drain || state->link_credit != rcv->credit - rcv->queued) || !ssn->state.incoming_window)) {
       state->link_credit = rcv->credit - rcv->queued;
-      return pn_post_flow(transport, ssn, rcv);
+      return pni_post_flow(transport, ssn, rcv);
     }
   }
 
   return 0;
 }
 
-int pn_flush_disp(pn_transport_t *transport, pn_session_t *ssn)
+static int pni_flush_disp(pn_transport_t *transport, pn_session_t *ssn)
 {
   uint64_t code = ssn->state.disp_code;
   bool settled = ssn->state.disp_settled;
@@ -2001,7 +2001,7 @@ int pn_flush_disp(pn_transport_t *transport, pn_session_t *ssn)
   return 0;
 }
 
-int pn_post_disp(pn_transport_t *transport, pn_delivery_t *delivery)
+static int pni_post_disp(pn_transport_t *transport, pn_delivery_t *delivery)
 {
   pn_link_t *link = delivery->link;
   pn_session_t *ssn = link->session;
@@ -2038,7 +2038,7 @@ int pn_post_disp(pn_transport_t *transport, pn_delivery_t *delivery)
   }
 
   if (ssn_state->disp) {
-    int err = pn_flush_disp(transport, ssn);
+    int err = pni_flush_disp(transport, ssn);
     if (err) return err;
   }
 
@@ -2052,7 +2052,7 @@ int pn_post_disp(pn_transport_t *transport, pn_delivery_t *delivery)
   return 0;
 }
 
-int pn_process_tpwork_sender(pn_transport_t *transport, pn_delivery_t *delivery, bool *settle)
+static int pni_process_tpwork_sender(pn_transport_t *transport, pn_delivery_t *delivery, bool *settle)
 {
   *settle = false;
   pn_link_t *link = delivery->link;
@@ -2064,7 +2064,7 @@ int pn_process_tpwork_sender(pn_transport_t *transport, pn_delivery_t *delivery,
     if (!state->sent && (delivery->done || pn_buffer_size(delivery->bytes) > 0) &&
         ssn_state->remote_incoming_window > 0 && link_state->link_credit > 0) {
       if (!state->init) {
-        state = pn_delivery_map_push(&ssn_state->outgoing, delivery);
+        state = pni_delivery_map_push(&ssn_state->outgoing, delivery);
       }
 
       pn_bytes_t bytes = pn_buffer_bytes(delivery->bytes);
@@ -2073,7 +2073,7 @@ int pn_process_tpwork_sender(pn_transport_t *transport, pn_delivery_t *delivery,
       pn_data_clear(transport->disp_data);
       pni_disposition_encode(&delivery->local, transport->disp_data);
 
-      int count = pn_post_amqp_transfer_frame(transport,
+      int count = pni_post_amqp_transfer_frame(transport,
                                               ssn_state->local_channel,
                                               link_state->local_handle,
                                               state->id, &bytes, &tag,
@@ -2105,7 +2105,7 @@ int pn_process_tpwork_sender(pn_transport_t *transport, pn_delivery_t *delivery,
   pn_delivery_state_t *state = delivery->state.init ? &delivery->state : NULL;
   if ((int16_t) ssn_state->local_channel >= 0 && !delivery->remote.settled
       && state && state->sent && !xfr_posted) {
-    int err = pn_post_disp(transport, delivery);
+    int err = pni_post_disp(transport, delivery);
     if (err) return err;
   }
 
@@ -2113,20 +2113,20 @@ int pn_process_tpwork_sender(pn_transport_t *transport, pn_delivery_t *delivery,
   return 0;
 }
 
-int pn_process_tpwork_receiver(pn_transport_t *transport, pn_delivery_t *delivery, bool *settle)
+static int pni_process_tpwork_receiver(pn_transport_t *transport, pn_delivery_t *delivery, bool *settle)
 {
   *settle = false;
   pn_link_t *link = delivery->link;
   // XXX: need to prevent duplicate disposition sending
   pn_session_t *ssn = link->session;
   if ((int16_t) ssn->state.local_channel >= 0 && !delivery->remote.settled && delivery->state.init) {
-    int err = pn_post_disp(transport, delivery);
+    int err = pni_post_disp(transport, delivery);
     if (err) return err;
   }
 
   // XXX: need to centralize this policy and improve it
   if (!ssn->state.incoming_window) {
-    int err = pn_post_flow(transport, ssn, link);
+    int err = pni_post_flow(transport, ssn, link);
     if (err) return err;
   }
 
@@ -2134,7 +2134,7 @@ int pn_process_tpwork_receiver(pn_transport_t *transport, pn_delivery_t *deliver
   return 0;
 }
 
-int pn_process_tpwork(pn_transport_t *transport, pn_endpoint_t *endpoint)
+static int pni_process_tpwork(pn_transport_t *transport, pn_endpoint_t *endpoint)
 {
   if (endpoint->type == CONNECTION && !transport->close_sent)
   {
@@ -2149,11 +2149,11 @@ int pn_process_tpwork(pn_transport_t *transport, pn_endpoint_t *endpoint)
       pn_delivery_map_t *dm = NULL;
       if (pn_link_is_sender(link)) {
         dm = &link->session->state.outgoing;
-        int err = pn_process_tpwork_sender(transport, delivery, &settle);
+        int err = pni_process_tpwork_sender(transport, delivery, &settle);
         if (err) return err;
       } else {
         dm = &link->session->state.incoming;
-        int err = pn_process_tpwork_receiver(transport, delivery, &settle);
+        int err = pni_process_tpwork_receiver(transport, delivery, &settle);
         if (err) return err;
       }
 
@@ -2170,14 +2170,14 @@ int pn_process_tpwork(pn_transport_t *transport, pn_endpoint_t *endpoint)
   return 0;
 }
 
-int pn_process_flush_disp(pn_transport_t *transport, pn_endpoint_t *endpoint)
+static int pni_process_flush_disp(pn_transport_t *transport, pn_endpoint_t *endpoint)
 {
   if (endpoint->type == SESSION) {
     pn_session_t *session = (pn_session_t *) endpoint;
     pn_session_state_t *state = &session->state;
     if ((int16_t) state->local_channel >= 0 && !transport->close_sent)
     {
-      int err = pn_flush_disp(transport, session);
+      int err = pni_flush_disp(transport, session);
       if (err) return err;
     }
   }
@@ -2185,7 +2185,7 @@ int pn_process_flush_disp(pn_transport_t *transport, pn_endpoint_t *endpoint)
   return 0;
 }
 
-int pn_process_flow_sender(pn_transport_t *transport, pn_endpoint_t *endpoint)
+static int pni_process_flow_sender(pn_transport_t *transport, pn_endpoint_t *endpoint)
 {
   if (endpoint->type == SENDER && endpoint->state & PN_LOCAL_ACTIVE)
   {
@@ -2200,7 +2200,7 @@ int pn_process_flow_sender(pn_transport_t *transport, pn_endpoint_t *endpoint)
         state->delivery_count += state->link_credit;
         state->link_credit = 0;
         snd->drained = 0;
-        return pn_post_flow(transport, ssn, snd);
+        return pni_post_flow(transport, ssn, snd);
       }
     }
   }
@@ -2219,7 +2219,7 @@ static void pni_unmap_local_handle(pn_link_t *link) {
   pn_hash_del(link->session->state.local_handles, handle);
 }
 
-int pn_process_link_teardown(pn_transport_t *transport, pn_endpoint_t *endpoint)
+static int pni_process_link_teardown(pn_transport_t *transport, pn_endpoint_t *endpoint)
 {
   if (endpoint->type == SENDER || endpoint->type == RECEIVER)
   {
@@ -2258,7 +2258,7 @@ int pn_process_link_teardown(pn_transport_t *transport, pn_endpoint_t *endpoint)
   return 0;
 }
 
-bool pn_pointful_buffering(pn_transport_t *transport, pn_session_t *session)
+static bool pni_pointful_buffering(pn_transport_t *transport, pn_session_t *session)
 {
   if (transport->close_rcvd) return false;
   if (!transport->open_rcvd) return true;
@@ -2283,7 +2283,7 @@ bool pn_pointful_buffering(pn_transport_t *transport, pn_session_t *session)
 
 static void pni_unmap_local_channel(pn_session_t *ssn) {
   // XXX: should really update link state also
-  pn_delivery_map_clear(&ssn->state.outgoing);
+  pni_delivery_map_clear(&ssn->state.outgoing);
   pni_transport_unbind_handles(ssn->state.local_handles, false);
   pn_transport_t *transport = ssn->connection->transport;
   pn_session_state_t *state = &ssn->state;
@@ -2296,7 +2296,7 @@ static void pni_unmap_local_channel(pn_session_t *ssn) {
   pn_hash_del(transport->local_channels, channel);
 }
 
-int pn_process_ssn_teardown(pn_transport_t *transport, pn_endpoint_t *endpoint)
+static int pni_process_ssn_teardown(pn_transport_t *transport, pn_endpoint_t *endpoint)
 {
   if (endpoint->type == SESSION)
   {
@@ -2305,7 +2305,7 @@ int pn_process_ssn_teardown(pn_transport_t *transport, pn_endpoint_t *endpoint)
     if (endpoint->state & PN_LOCAL_CLOSED && (int16_t) state->local_channel >= 0
         && !transport->close_sent)
     {
-      if (pn_pointful_buffering(transport, session)) {
+      if (pni_pointful_buffering(transport, session)) {
         return 0;
       }
 
@@ -2330,13 +2330,13 @@ int pn_process_ssn_teardown(pn_transport_t *transport, pn_endpoint_t *endpoint)
   return 0;
 }
 
-int pn_process_conn_teardown(pn_transport_t *transport, pn_endpoint_t *endpoint)
+static int pni_process_conn_teardown(pn_transport_t *transport, pn_endpoint_t *endpoint)
 {
   if (endpoint->type == CONNECTION)
   {
     if (endpoint->state & PN_LOCAL_CLOSED && !transport->close_sent) {
-      if (pn_pointful_buffering(transport, NULL)) return 0;
-      int err = pn_post_close(transport, NULL, NULL);
+      if (pni_pointful_buffering(transport, NULL)) return 0;
+      int err = pni_post_close(transport, NULL, NULL);
       if (err) return err;
       transport->close_sent = true;
     }
@@ -2346,7 +2346,7 @@ int pn_process_conn_teardown(pn_transport_t *transport, pn_endpoint_t *endpoint)
   return 0;
 }
 
-int pn_phase(pn_transport_t *transport, int (*phase)(pn_transport_t *, pn_endpoint_t *))
+static int pni_phase(pn_transport_t *transport, int (*phase)(pn_transport_t *, pn_endpoint_t *))
 {
   pn_connection_t *conn = transport->connection;
   pn_endpoint_t *endpoint = conn->transport_head;
@@ -2360,26 +2360,26 @@ int pn_phase(pn_transport_t *transport, int (*phase)(pn_transport_t *, pn_endpoi
   return 0;
 }
 
-int pn_process(pn_transport_t *transport)
+static int pni_process(pn_transport_t *transport)
 {
   int err;
-  if ((err = pn_phase(transport, pn_process_conn_setup))) return err;
-  if ((err = pn_phase(transport, pn_process_ssn_setup))) return err;
-  if ((err = pn_phase(transport, pn_process_link_setup))) return err;
-  if ((err = pn_phase(transport, pn_process_flow_receiver))) return err;
+  if ((err = pni_phase(transport, pni_process_conn_setup))) return err;
+  if ((err = pni_phase(transport, pni_process_ssn_setup))) return err;
+  if ((err = pni_phase(transport, pni_process_link_setup))) return err;
+  if ((err = pni_phase(transport, pni_process_flow_receiver))) return err;
 
   // XXX: this has to happen two times because we might settle stuff
   // on the first pass and create space for more work to be done on the
   // second pass
-  if ((err = pn_phase(transport, pn_process_tpwork))) return err;
-  if ((err = pn_phase(transport, pn_process_tpwork))) return err;
+  if ((err = pni_phase(transport, pni_process_tpwork))) return err;
+  if ((err = pni_phase(transport, pni_process_tpwork))) return err;
 
-  if ((err = pn_phase(transport, pn_process_flush_disp))) return err;
+  if ((err = pni_phase(transport, pni_process_flush_disp))) return err;
 
-  if ((err = pn_phase(transport, pn_process_flow_sender))) return err;
-  if ((err = pn_phase(transport, pn_process_link_teardown))) return err;
-  if ((err = pn_phase(transport, pn_process_ssn_teardown))) return err;
-  if ((err = pn_phase(transport, pn_process_conn_teardown))) return err;
+  if ((err = pni_phase(transport, pni_process_flow_sender))) return err;
+  if ((err = pni_phase(transport, pni_process_link_teardown))) return err;
+  if ((err = pni_phase(transport, pni_process_ssn_teardown))) return err;
+  if ((err = pni_phase(transport, pni_process_conn_teardown))) return err;
 
   if (transport->connection->tpwork_head) {
     pn_modified(transport->connection, &transport->connection->endpoint, false);
@@ -2407,7 +2407,7 @@ static ssize_t pn_output_write_amqp_header(pn_transport_t* transport, unsigned i
 static ssize_t pn_output_write_amqp(pn_transport_t* transport, unsigned int layer, char* bytes, size_t available)
 {
   if (transport->connection && !transport->done_processing) {
-    int err = pn_process(transport);
+    int err = pni_process(transport);
     if (err) {
       pn_transport_logf(transport, "process error %i", err);
       transport->done_processing = true;


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


[20/50] [abbrv] qpid-proton git commit: NO-JIRA: Add in SASL pieces to Travis CI build

Posted by kg...@apache.org.
NO-JIRA: Add in SASL pieces to Travis CI build


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

Branch: refs/heads/kgiusti-python3
Commit: e55fe323e08f4ac3a8f51d055cae7eb460b96018
Parents: d7df576
Author: Andrew Stitcher <as...@apache.org>
Authored: Wed Jun 3 16:47:51 2015 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Thu Jun 11 16:20:28 2015 -0400

----------------------------------------------------------------------
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e55fe323/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 8d12bc4..7493ca2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
 language: c
 install:
   - sudo apt-get update -qq
-  - sudo apt-get install -y -qq bash cmake libssl-dev maven ruby python php5 openjdk-7-jdk swig uuid-dev valgrind
+  - sudo apt-get install -y -qq bash cmake libssl-dev maven ruby python php5 openjdk-7-jdk swig uuid-dev valgrind libsasl2-dev sasl2-bin
 script:
   - bin/jenkins-proton-c-build.sh


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


[39/50] [abbrv] qpid-proton git commit: PROTON-915: Send correct AMQP header upon protocol mismatch - Split apart the transport tests into client and server tests

Posted by kg...@apache.org.
PROTON-915: Send correct AMQP header upon protocol mismatch
- Split apart the transport tests into client and server tests


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

Branch: refs/heads/kgiusti-python3
Commit: 3aab9a07bca507aa9160e00eb54179b3df441ebb
Parents: 638c18b
Author: Andrew Stitcher <as...@apache.org>
Authored: Wed Jun 17 15:44:29 2015 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Wed Jun 17 18:39:03 2015 -0400

----------------------------------------------------------------------
 proton-c/src/transport/transport.c     |  13 +-
 tests/python/proton_tests/transport.py | 190 ++++++++++++++++++++++++++--
 2 files changed, 191 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3aab9a07/proton-c/src/transport/transport.c
----------------------------------------------------------------------
diff --git a/proton-c/src/transport/transport.c b/proton-c/src/transport/transport.c
index 0e23975..733f695 100644
--- a/proton-c/src/transport/transport.c
+++ b/proton-c/src/transport/transport.c
@@ -168,6 +168,13 @@ const pn_io_layer_t pni_passthru_layer = {
     NULL
 };
 
+const pn_io_layer_t pni_header_error_layer = {
+    pn_io_layer_input_error,
+    pn_output_write_amqp_header,
+    NULL,
+    NULL
+};
+
 const pn_io_layer_t pni_error_layer = {
     pn_io_layer_input_error,
     pn_io_layer_output_error,
@@ -286,7 +293,7 @@ ssize_t pn_io_layer_input_autodetect(pn_transport_t *transport, unsigned int lay
   pn_do_error(transport, "amqp:connection:framing-error",
               "%s: '%s'%s", error, quoted,
               !eos ? "" : " (connection aborted)");
-  pn_set_error_layer(transport);
+  transport->io_layers[layer] = &pni_header_error_layer;
   return 0;
 }
 
@@ -2397,7 +2404,9 @@ static ssize_t pn_output_write_amqp_header(pn_transport_t* transport, unsigned i
     pn_transport_logf(transport, "  -> %s", "AMQP");
   assert(available >= 8);
   memmove(bytes, AMQP_HEADER, 8);
-  if (transport->io_layers[layer] == &amqp_write_header_layer) {
+  if (transport->io_layers[layer] == &pni_header_error_layer) {
+    transport->io_layers[layer] = &pni_error_layer;
+  }else if (transport->io_layers[layer] == &amqp_write_header_layer) {
     transport->io_layers[layer] = &amqp_layer;
   } else {
     transport->io_layers[layer] = &amqp_read_header_layer;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3aab9a07/tests/python/proton_tests/transport.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/transport.py b/tests/python/proton_tests/transport.py
index e56b122..958abf7 100644
--- a/tests/python/proton_tests/transport.py
+++ b/tests/python/proton_tests/transport.py
@@ -24,7 +24,7 @@ from proton import *
 class Test(common.Test):
   pass
 
-class TransportTest(Test):
+class ClientTransportTest(Test):
 
   def setup(self):
     self.transport = Transport()
@@ -87,6 +87,16 @@ class TransportTest(Test):
     self.transport.close_tail()
     self.assert_error(u'amqp:connection:framing-error')
 
+  def testProtocolNotSupported(self):
+    self.transport.push("AMQP\x01\x01\x0a\x00")
+    p = self.transport.pending()
+    assert p >= 8, p
+    bytes = self.transport.peek(p)
+    assert bytes[:8] == "AMQP\x00\x01\x00\x00"
+    self.transport.pop(p)
+    self.drain()
+    assert self.transport.closed
+
   def testPeek(self):
     out = self.transport.peek(1024)
     assert out is not None
@@ -163,30 +173,190 @@ class TransportTest(Test):
     self.peer.push(dat2[len(dat1):])
     self.peer.push(dat3)
 
+class ServerTransportTest(Test):
+
+  def setup(self):
+    self.transport = Transport(Transport.SERVER)
+    self.peer = Transport()
+    self.conn = Connection()
+    self.peer.bind(self.conn)
+
+  def teardown(self):
+    self.transport = None
+    self.peer = None
+    self.conn = None
+
+  def drain(self):
+    while True:
+      p = self.transport.pending()
+      if p < 0:
+        return
+      elif p > 0:
+        bytes = self.transport.peek(p)
+        self.peer.push(bytes)
+        self.transport.pop(len(bytes))
+      else:
+        assert False
+
+  def assert_error(self, name):
+    assert self.conn.remote_container is None, self.conn.remote_container
+    self.drain()
+    # verify that we received an open frame
+    assert self.conn.remote_container is not None, self.conn.remote_container
+    # verify that we received a close frame
+    assert self.conn.state == Endpoint.LOCAL_UNINIT | Endpoint.REMOTE_CLOSED, self.conn.state
+    # verify that a framing error was reported
+    assert self.conn.remote_condition.name == name, self.conn.remote_condition
+
+  # TODO: This may no longer be testing anything
+  def testEOS(self):
+    self.transport.push("") # should be a noop
+    self.transport.close_tail()
+    p = self.transport.pending()
+    self.drain()
+    assert self.transport.closed
+
+  def testPartial(self):
+    self.transport.push("AMQ") # partial header
+    self.transport.close_tail()
+    p = self.transport.pending()
+    assert p >= 8, p
+    bytes = self.transport.peek(p)
+    assert bytes[:8] == "AMQP\x00\x01\x00\x00"
+    self.transport.pop(p)
+    self.drain()
+    assert self.transport.closed
+
+  def testGarbage(self, garbage="GARBAGE_"):
+    self.transport.push(garbage)
+    p = self.transport.pending()
+    assert p >= 8, p
+    bytes = self.transport.peek(p)
+    assert bytes[:8] == "AMQP\x00\x01\x00\x00"
+    self.transport.pop(p)
+    self.drain()
+    assert self.transport.closed
+
+  def testSmallGarbage(self):
+    self.testGarbage("XXX")
+
+  def testBigGarbage(self):
+    self.testGarbage("GARBAGE_XXX")
+
+  def testHeader(self):
+    self.transport.push("AMQP\x00\x01\x00\x00")
+    self.transport.close_tail()
+    self.assert_error(u'amqp:connection:framing-error')
+
+  def testProtocolNotSupported(self):
+    self.transport.push("AMQP\x01\x01\x0a\x00")
+    p = self.transport.pending()
+    assert p >= 8, p
+    bytes = self.transport.peek(p)
+    assert bytes[:8] == "AMQP\x00\x01\x00\x00"
+    self.transport.pop(p)
+    self.drain()
+    assert self.transport.closed
+
+  def testPeek(self):
+    out = self.transport.peek(1024)
+    assert out is not None
+
+  def testBindAfterOpen(self):
+    conn = Connection()
+    ssn = conn.session()
+    conn.open()
+    ssn.open()
+    conn.container = "test-container"
+    conn.hostname = "test-hostname"
+    trn = Transport()
+    trn.bind(conn)
+    out = trn.peek(1024)
+    assert "test-container" in out, repr(out)
+    assert "test-hostname" in out, repr(out)
+    self.transport.push(out)
+
+    c = Connection()
+    assert c.remote_container == None
+    assert c.remote_hostname == None
+    assert c.session_head(0) == None
+    self.transport.bind(c)
+    assert c.remote_container == "test-container"
+    assert c.remote_hostname == "test-hostname"
+    assert c.session_head(0) != None
+
+  def testCloseHead(self):
+    n = self.transport.pending()
+    assert n >= 0, n
+    try:
+      self.transport.close_head()
+    except TransportException, e:
+      assert "aborted" in str(e), str(e)
+    n = self.transport.pending()
+    assert n < 0, n
+
+  def testCloseTail(self):
+    n = self.transport.capacity()
+    assert n > 0, n
+    try:
+      self.transport.close_tail()
+    except TransportException, e:
+      assert "aborted" in str(e), str(e)
+    n = self.transport.capacity()
+    assert n < 0, n
+
+  def testUnpairedPop(self):
+    conn = Connection()
+    self.transport.bind(conn)
+
+    conn.hostname = "hostname"
+    conn.open()
+
+    dat1 = self.transport.peek(1024)
+
+    ssn = conn.session()
+    ssn.open()
+
+    dat2 = self.transport.peek(1024)
+
+    assert dat2[:len(dat1)] == dat1
+
+    snd = ssn.sender("sender")
+    snd.open()
+
+    self.transport.pop(len(dat1))
+    self.transport.pop(len(dat2) - len(dat1))
+    dat3 = self.transport.peek(1024)
+    self.transport.pop(len(dat3))
+    assert self.transport.peek(1024) == ""
+
+    self.peer.push(dat1)
+    self.peer.push(dat2[len(dat1):])
+    self.peer.push(dat3)
+
   def testEOSAfterSASL(self):
-    srv = Transport(mode=Transport.SERVER)
-    srv.sasl().allowed_mechs('ANONYMOUS')
+    self.transport.sasl().allowed_mechs('ANONYMOUS')
 
     self.peer.sasl().allowed_mechs('ANONYMOUS')
 
     # this should send over the sasl header plus a sasl-init set up
     # for anonymous
     p = self.peer.pending()
-    srv.push(self.peer.peek(p))
+    self.transport.push(self.peer.peek(p))
     self.peer.pop(p)
 
     # now we send EOS
-    srv.close_tail()
+    self.transport.close_tail()
 
     # the server may send an error back
-    p = srv.pending()
+    p = self.transport.pending()
     while p>0:
-      self.peer.push(srv.peek(p))
-      srv.pop(p)
-      p = srv.pending()
+      self.peer.push(self.transport.peek(p))
+      self.transport.pop(p)
+      p = self.transport.pending()
 
     # server closed
-    assert srv.pending() < 0
+    assert self.transport.pending() < 0
 
 class LogTest(Test):
 


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


[50/50] [abbrv] qpid-proton git commit: PROTON-490: fail ctest if any of the tox runs fail

Posted by kg...@apache.org.
PROTON-490: fail ctest if any of the tox runs fail


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

Branch: refs/heads/kgiusti-python3
Commit: e7f49fa0ac9083d8efab697c47c46a91c458187d
Parents: 35eb6bb
Author: Ken Giusti <kg...@apache.org>
Authored: Thu Jun 18 16:09:31 2015 -0400
Committer: Ken Giusti <kg...@apache.org>
Committed: Thu Jun 18 16:09:31 2015 -0400

----------------------------------------------------------------------
 proton-c/CMakeLists.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e7f49fa0/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index 5985e2d..a1cf0e4 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -523,7 +523,10 @@ if (BUILD_PYTHON)
 		   "PATH=${py_path}" "QPID_PROTON_SRC=${CMAKE_CURRENT_SOURCE_DIR}/../" ${VALGRIND_ENV}
                    tox
 		   WORKING_DIRECTORY ${py_src})
-         set_tests_properties(python-tox-test PROPERTIES PASS_REGULAR_EXPRESSION "Totals: .* 0 failed")
+         set_tests_properties(python-tox-test
+                              PROPERTIES
+                              PASS_REGULAR_EXPRESSION "Totals: .* ignored, 0 failed"
+                              FAIL_REGULAR_EXPRESSION "ERROR:[ ]+py[0-9]*: commands failed")
      else (TOX_CMD)
          message(STATUS "The tox tool is not available - skipping the python-tox-tests")
      endif (TOX_CMD)


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


[25/50] [abbrv] qpid-proton git commit: Merge branch 'master' into kgiusti-python3

Posted by kg...@apache.org.
Merge branch 'master' into kgiusti-python3

Conflicts:
	proton-c/bindings/python/proton/__init__.py
	tests/python/proton_tests/sasl.py


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

Branch: refs/heads/kgiusti-python3
Commit: 2721c639fc5e750291d4badd081d6f6d1207434f
Parents: 43a61bb c2c178c
Author: Ken Giusti <kg...@apache.org>
Authored: Mon Jun 15 13:19:55 2015 -0400
Committer: Ken Giusti <kg...@apache.org>
Committed: Mon Jun 15 13:19:55 2015 -0400

----------------------------------------------------------------------
 .gitattributes                                  |   2 +
 .gitignore                                      |   6 +
 .travis.yml                                     |   2 +-
 LICENSE                                         |   6 +
 README.md                                       |   4 +
 appveyor.yml                                    |  16 +
 bin/export.sh                                   |  29 +-
 examples/engine/java/drain                      |   2 +-
 examples/engine/java/pom.xml                    |   2 +-
 examples/engine/java/server                     |   2 +-
 examples/engine/java/spout                      |   2 +-
 examples/go/README.md                           |  69 ++
 examples/go/event/broker.go                     | 186 ++--
 examples/go/example.go                          |  54 --
 examples/go/receive.go                          |  99 +-
 examples/go/send.go                             | 117 ++-
 examples/python/README                          |  22 +
 examples/python/reactor/send.py                 |   3 +
 examples/ruby/engine_recv.rb                    | 158 ++++
 examples/ruby/engine_send.rb                    | 143 +++
 examples/ruby/lib/driver.rb                     |  69 ++
 examples/ruby/lib/qpid_examples.rb              |  28 +
 examples/ruby/lib/selectable.rb                 | 120 +++
 examples/ruby/messenger/README.md               | 163 ++++
 examples/ruby/messenger/client.rb               |   2 +-
 examples/ruby/messenger/mailserver.rb           |   3 +-
 examples/ruby/messenger/nonblocking_recv.rb     | 145 +++
 examples/ruby/messenger/passive_recv.rb         | 140 ---
 examples/ruby/messenger/recv.rb                 |   2 +-
 examples/ruby/messenger/send.rb                 |   2 +-
 examples/ruby/wrapper_test.rb                   |  82 ++
 proton-c/CMakeLists.txt                         |  52 +-
 proton-c/bindings/CMakeLists.txt                |   2 +-
 proton-c/bindings/go/README.md                  | 196 +---
 proton-c/bindings/go/WARNING_EXPERIMENTAL       |   1 -
 proton-c/bindings/go/src/Makefile               |  25 -
 proton-c/bindings/go/src/genwrap.go             | 398 --------
 .../go/src/qpid.apache.org/proton/doc.go        |  36 -
 .../go/src/qpid.apache.org/proton/dummy.go      |  82 --
 .../go/src/qpid.apache.org/proton/error.go      | 111 ---
 .../go/src/qpid.apache.org/proton/event/doc.go  |  28 -
 .../src/qpid.apache.org/proton/event/error.go   |  77 --
 .../qpid.apache.org/proton/event/handlers.go    | 328 -------
 .../go/src/qpid.apache.org/proton/event/pump.go | 262 ------
 .../qpid.apache.org/proton/event/wrappers.go    | 137 ---
 .../proton/event/wrappers_gen.go                | 505 ----------
 .../src/qpid.apache.org/proton/interop_test.go  | 308 -------
 .../go/src/qpid.apache.org/proton/marshal.go    | 229 -----
 .../go/src/qpid.apache.org/proton/message.go    | 388 --------
 .../src/qpid.apache.org/proton/message_test.go  |  90 --
 .../go/src/qpid.apache.org/proton/types.go      | 193 ----
 .../go/src/qpid.apache.org/proton/unmarshal.go  | 530 -----------
 .../go/src/qpid.apache.org/proton/url.go        |  95 --
 .../go/src/qpid.apache.org/proton/url_test.go   |  51 --
 proton-c/bindings/javascript/CMakeLists.txt     |   9 +-
 proton-c/bindings/javascript/binding.c          |   2 +
 proton-c/bindings/php/php.i                     |  15 -
 proton-c/bindings/python/CMakeLists.txt         |  13 +
 proton-c/bindings/python/MANIFEST.in            |   2 +
 proton-c/bindings/python/cproton.i              |  36 +
 proton-c/bindings/python/docs/Makefile          | 153 ----
 proton-c/bindings/python/docs/README            |   5 -
 proton-c/bindings/python/docs/conf.py           | 242 +++++
 proton-c/bindings/python/docs/index.rst         |  11 +
 proton-c/bindings/python/docs/make.bat          | 190 ----
 proton-c/bindings/python/docs/overview.rst      | 160 ++++
 proton-c/bindings/python/docs/source/conf.py    | 242 -----
 proton-c/bindings/python/docs/source/index.rst  |  24 -
 .../bindings/python/docs/source/overview.rst    | 161 ----
 .../bindings/python/docs/source/reference.rst   |  44 -
 .../bindings/python/docs/source/tutorial.rst    | 301 ------
 proton-c/bindings/python/docs/tutorial.rst      | 301 ++++++
 proton-c/bindings/python/proton/__init__.py     |  70 +-
 proton-c/bindings/python/proton/handlers.py     |   2 +-
 proton-c/bindings/python/proton/reactor.py      |  27 +-
 proton-c/bindings/python/setup.py               | 305 ++++++-
 .../python/setuputils/PYZMQ_LICENSE.BSD         |  32 +
 proton-c/bindings/python/setuputils/__init__.py |   0
 proton-c/bindings/python/setuputils/bundle.py   |  84 ++
 proton-c/bindings/python/setuputils/log.py      |  46 +
 proton-c/bindings/python/setuputils/misc.py     |  55 ++
 proton-c/bindings/python/tox.ini                |  32 +
 proton-c/bindings/ruby/.yardopts                |   1 +
 proton-c/bindings/ruby/lib/codec/data.rb        | 912 +++++++++++++++++++
 proton-c/bindings/ruby/lib/codec/mapping.rb     | 169 ++++
 proton-c/bindings/ruby/lib/core/connection.rb   | 328 +++++++
 proton-c/bindings/ruby/lib/core/delivery.rb     | 271 ++++++
 proton-c/bindings/ruby/lib/core/disposition.rb  | 158 ++++
 proton-c/bindings/ruby/lib/core/endpoint.rb     | 115 +++
 proton-c/bindings/ruby/lib/core/exceptions.rb   | 116 +++
 proton-c/bindings/ruby/lib/core/link.rb         | 387 ++++++++
 proton-c/bindings/ruby/lib/core/message.rb      | 633 +++++++++++++
 proton-c/bindings/ruby/lib/core/receiver.rb     |  95 ++
 proton-c/bindings/ruby/lib/core/sasl.rb         |  94 ++
 proton-c/bindings/ruby/lib/core/sender.rb       |  76 ++
 proton-c/bindings/ruby/lib/core/session.rb      | 163 ++++
 proton-c/bindings/ruby/lib/core/ssl.rb          | 160 ++++
 proton-c/bindings/ruby/lib/core/ssl_details.rb  |  33 +
 proton-c/bindings/ruby/lib/core/ssl_domain.rb   | 156 ++++
 proton-c/bindings/ruby/lib/core/terminus.rb     | 218 +++++
 proton-c/bindings/ruby/lib/core/transport.rb    | 412 +++++++++
 proton-c/bindings/ruby/lib/event/collector.rb   | 148 +++
 proton-c/bindings/ruby/lib/event/event.rb       | 296 ++++++
 proton-c/bindings/ruby/lib/event/event_base.rb  |  91 ++
 proton-c/bindings/ruby/lib/event/event_type.rb  |  71 ++
 proton-c/bindings/ruby/lib/messenger/filters.rb |  64 ++
 .../bindings/ruby/lib/messenger/messenger.rb    | 702 ++++++++++++++
 .../bindings/ruby/lib/messenger/selectable.rb   | 124 +++
 .../bindings/ruby/lib/messenger/subscription.rb |  37 +
 proton-c/bindings/ruby/lib/messenger/tracker.rb |  38 +
 .../ruby/lib/messenger/tracker_status.rb        |  69 ++
 proton-c/bindings/ruby/lib/qpid_proton.rb       |  95 +-
 proton-c/bindings/ruby/lib/qpid_proton/array.rb | 173 ----
 proton-c/bindings/ruby/lib/qpid_proton/data.rb  | 788 ----------------
 .../bindings/ruby/lib/qpid_proton/described.rb  |  66 --
 .../ruby/lib/qpid_proton/exception_handling.rb  | 127 ---
 .../bindings/ruby/lib/qpid_proton/exceptions.rb |  85 --
 .../bindings/ruby/lib/qpid_proton/filters.rb    |  67 --
 proton-c/bindings/ruby/lib/qpid_proton/hash.rb  |  86 --
 .../bindings/ruby/lib/qpid_proton/mapping.rb    | 170 ----
 .../bindings/ruby/lib/qpid_proton/message.rb    | 621 -------------
 .../bindings/ruby/lib/qpid_proton/messenger.rb  | 702 --------------
 .../bindings/ruby/lib/qpid_proton/selectable.rb | 126 ---
 .../bindings/ruby/lib/qpid_proton/strings.rb    |  65 --
 .../ruby/lib/qpid_proton/subscription.rb        |  41 -
 .../bindings/ruby/lib/qpid_proton/tracker.rb    |  42 -
 .../ruby/lib/qpid_proton/tracker_status.rb      |  73 --
 .../bindings/ruby/lib/qpid_proton/version.rb    |  32 -
 proton-c/bindings/ruby/lib/types/array.rb       | 172 ++++
 proton-c/bindings/ruby/lib/types/described.rb   |  63 ++
 proton-c/bindings/ruby/lib/types/hash.rb        |  87 ++
 proton-c/bindings/ruby/lib/types/strings.rb     |  62 ++
 .../bindings/ruby/lib/util/class_wrapper.rb     |  52 ++
 proton-c/bindings/ruby/lib/util/condition.rb    |  45 +
 proton-c/bindings/ruby/lib/util/constants.rb    |  85 ++
 proton-c/bindings/ruby/lib/util/engine.rb       |  82 ++
 .../bindings/ruby/lib/util/error_handler.rb     | 127 +++
 proton-c/bindings/ruby/lib/util/swig_helper.rb  | 114 +++
 proton-c/bindings/ruby/lib/util/uuid.rb         |  32 +
 proton-c/bindings/ruby/lib/util/version.rb      |  30 +
 proton-c/bindings/ruby/lib/util/wrapper.rb      | 124 +++
 proton-c/bindings/ruby/ruby.i                   | 119 +++
 proton-c/include/proton/object.h                |   9 +-
 proton-c/include/proton/reactor.h               |   2 +
 proton-c/include/proton/sasl.h                  |  13 +
 proton-c/include/proton/ssl.h                   |  15 +
 proton-c/include/proton/transport.h             |   2 +-
 proton-c/src/buffer.c                           |  90 +-
 proton-c/src/codec/codec.c                      | 195 ++--
 proton-c/src/codec/decoder.c                    |  28 +-
 proton-c/src/config.h                           |  26 +
 proton-c/src/engine/engine-internal.h           |  10 -
 proton-c/src/engine/engine.c                    | 124 +--
 proton-c/src/error.c                            |   8 +-
 proton-c/src/messenger/messenger.c              |  42 +-
 proton-c/src/messenger/store.c                  |  22 +-
 proton-c/src/object/list.c                      |  11 +-
 proton-c/src/object/map.c                       |  16 +-
 proton-c/src/object/object.c                    |   9 +-
 proton-c/src/parser.c                           | 129 ++-
 proton-c/src/platform.c                         |  48 +-
 proton-c/src/platform.h                         |  22 +-
 proton-c/src/posix/io.c                         |   2 +-
 proton-c/src/reactor/acceptor.c                 |  15 +
 proton-c/src/sasl/cyrus_sasl.c                  | 888 +++++-------------
 proton-c/src/sasl/none_sasl.c                   | 490 +++-------
 proton-c/src/sasl/sasl-internal.h               |  60 +-
 proton-c/src/sasl/sasl.c                        | 505 +++++++++-
 proton-c/src/scanner.c                          |  92 +-
 proton-c/src/ssl/openssl.c                      |  49 +-
 proton-c/src/ssl/ssl-internal.h                 |   4 +-
 proton-c/src/ssl/ssl_stub.c                     |  10 +
 proton-c/src/transport/transport.c              | 209 ++---
 proton-c/src/util.c                             |  31 +-
 proton-c/src/util.h                             |  10 +-
 proton-c/src/windows/schannel.c                 |  37 +-
 .../org/apache/qpid/proton/engine/Sasl.java     |  13 +
 .../qpid/proton/engine/impl/SaslImpl.java       |  22 +
 proton-j/src/main/resources/cengine.py          |   3 +
 proton-j/src/main/resources/csasl.py            |  19 +
 .../qpid/proton/systemtests/SaslTest.java       | 100 ++
 tests/python/proton_tests/common.py             |  12 +-
 tests/python/proton_tests/engine.py             |  47 +
 tests/python/proton_tests/sasl.py               | 248 ++++-
 tests/python/proton_tests/ssl.py                |  62 +-
 tests/python/proton_tests/transport.py          |  15 +
 tests/tools/apps/c/reactor-recv.c               |   8 +-
 187 files changed, 12313 insertions(+), 10517 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/proton-c/bindings/python/cproton.i
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/proton-c/bindings/python/proton/__init__.py
----------------------------------------------------------------------
diff --cc proton-c/bindings/python/proton/__init__.py
index 2098ef9,9432bd8..747bfad
--- a/proton-c/bindings/python/proton/__init__.py
+++ b/proton-c/bindings/python/proton/__init__.py
@@@ -79,16 -76,16 +79,16 @@@ except ImportError
    rand = random.Random()
    rand.seed((os.getpid(), time.time(), socket.gethostname()))
    def random_uuid():
 -    bytes = [rand.randint(0, 255) for i in xrange(16)]
 +    data = [rand.randint(0, 255) for i in xrange(16)]
  
      # From RFC4122, the version bits are set to 0100
-     data[7] &= 0x0F
-     data[7] |= 0x40
 -    bytes[6] &= 0x0F
 -    bytes[6] |= 0x40
++    data[6] &= 0x0F
++    data[6] |= 0x40
  
      # From RFC4122, the top two bits of byte 8 get set to 01
 -    bytes[8] &= 0x3F
 -    bytes[8] |= 0x80
 -    return "".join(map(chr, bytes))
 +    data[8] &= 0x3F
 +    data[8] |= 0x80
 +    return "".join(map(chr, data))
  
    def uuid4():
      return uuid.UUID(bytes=random_uuid())

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/proton-c/bindings/python/proton/handlers.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/proton-c/bindings/python/proton/reactor.py
----------------------------------------------------------------------
diff --cc proton-c/bindings/python/proton/reactor.py
index b475333,a7b0717..c66334b
--- a/proton-c/bindings/python/proton/reactor.py
+++ b/proton-c/bindings/python/proton/reactor.py
@@@ -488,9 -489,13 +496,13 @@@ class Connector(Handler)
      def _connect(self, connection):
          url = self.address.next()
          # IoHandler uses the hostname to determine where to try to connect to
 -        connection.hostname = "%s:%i" % (url.host, url.port)
 +        connection.hostname = "%s:%s" % (url.host, url.port)
          logging.info("connecting to %s..." % connection.hostname)
  
+         if url.username:
+             connection.user = url.username
+         if url.password:
+             connection.password = url.password
          transport = Transport()
          transport.bind(connection)
          if self.heartbeat:

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/tests/python/proton_tests/common.py
----------------------------------------------------------------------
diff --cc tests/python/proton_tests/common.py
index 4f23c13,83a39f8..8bb3609
--- a/tests/python/proton_tests/common.py
+++ b/tests/python/proton_tests/common.py
@@@ -244,12 -225,16 +246,18 @@@ class MessengerApp(object)
                      del cmd[0:1]
                      cmd.insert(0, foundfile)
                      cmd.insert(0, sys.executable)
 -            self._process = Popen(cmd, stdout=PIPE, stderr=STDOUT, bufsize=4096)
 -        except OSError, e:
 +            self._process = Popen(cmd, stdout=PIPE, stderr=STDOUT,
 +                                  bufsize=4096, universal_newlines=True)
 +        except OSError:
 +            e = sys.exc_info()[1]
              print("ERROR: '%s'" % e)
-             assert False, "Unable to execute command '%s', is it in your PATH?" % cmd[0]
+             msg = "Unable to execute command '%s', is it in your PATH?" % cmd[0]
+ 
+             # NOTE(flaper87): Skip the test if the command is not found.
+             if e.errno == 2:
+               raise Skipped("Skipping test - %s" % msg)
+             assert False, msg
+ 
          self._ready()  # wait for it to initialize
  
      def stop(self):

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/tests/python/proton_tests/engine.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/tests/python/proton_tests/sasl.py
----------------------------------------------------------------------
diff --cc tests/python/proton_tests/sasl.py
index ce10882,91b3e69..b214b62
--- a/tests/python/proton_tests/sasl.py
+++ b/tests/python/proton_tests/sasl.py
@@@ -16,14 -16,71 +16,74 @@@
  # specific language governing permissions and limitations
  # under the License.
  #
 +from __future__ import absolute_import
  
 -import sys, os, common
 +import sys, os
 +from . import common
+ from string import Template
+ import subprocess
+ 
  from proton import *
 -from common import pump, Skipped
 +from .common import pump, Skipped
 +from proton._compat import str2bin
  
+ from cproton import *
+ 
+ def _sslCertpath(file):
+     """ Return the full path to the certificate,keyfile, etc.
+     """
+     return os.path.join(os.path.dirname(__file__),
+                         "ssl_db/%s" % file)
+ 
+ def _cyrusSetup(conf_dir):
+   """Write out simple SASL config
+   """
+   t = Template("""sasldb_path: ${db}
+ mech_list: EXTERNAL DIGEST-MD5 SCRAM-SHA-1 CRAM-MD5 PLAIN ANONYMOUS
+ """)
+   subprocess.call(args=['rm','-rf',conf_dir])
+   os.mkdir(conf_dir)
+   db = os.path.abspath(os.path.join(conf_dir,'proton.sasldb'))
+   conf = os.path.abspath(os.path.join(conf_dir,'proton.conf'))
+   f = open(conf, 'w')
+   f.write(t.substitute(db=db))
+   f.close()
+ 
+   cmd = Template("echo password | saslpasswd2 -c -p -f ${db} -u proton user").substitute(db=db)
+   subprocess.call(args=cmd, shell=True)
+ 
+ def _testSaslMech(self, mech, clientUser='user@proton', authUser='user@proton', encrypted=False, authenticated=True):
+   self.s1.allowed_mechs(mech)
+   self.c1.open()
+ 
+   pump(self.t1, self.t2, 1024)
+ 
+   if encrypted:
+     assert self.t2.encrypted == encrypted
+     assert self.t1.encrypted == encrypted
+   assert self.t2.authenticated == authenticated
+   assert self.t1.authenticated == authenticated
+   if authenticated:
+     # Server
+     assert self.t2.user == authUser
+     assert self.s2.user == authUser
+     assert self.s2.mech == mech.strip()
+     assert self.s2.outcome == SASL.OK
+     # Client
+     assert self.t1.user == clientUser
+     assert self.s1.user == clientUser
+     assert self.s1.mech == mech.strip()
+     assert self.s1.outcome == SASL.OK
+   else:
+     # Server
+     assert self.t2.user == None
+     assert self.s2.user == None
+     assert self.s2.outcome != SASL.OK
+     # Client
+     assert self.t1.user == clientUser
+     assert self.s1.user == clientUser
+     assert self.s1.outcome != SASL.OK
+ 
  class Test(common.Test):
    pass
  

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/tests/python/proton_tests/ssl.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2721c639/tests/python/proton_tests/transport.py
----------------------------------------------------------------------


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


[28/50] [abbrv] qpid-proton git commit: PROTON-887: SChannel version of pn_ssl_get_remote_subject()

Posted by kg...@apache.org.
PROTON-887: SChannel version of pn_ssl_get_remote_subject()


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

Branch: refs/heads/kgiusti-python3
Commit: 2117b3b6d9ebd1e6a157c437017f0456dc13a2f3
Parents: c2c178c
Author: Clifford Jansen <cl...@apache.org>
Authored: Tue Jun 16 07:42:42 2015 -0700
Committer: Clifford Jansen <cl...@apache.org>
Committed: Tue Jun 16 07:42:42 2015 -0700

----------------------------------------------------------------------
 proton-c/src/windows/schannel.c | 53 ++++++++++++++++++++++++++++--------
 1 file changed, 42 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2117b3b6/proton-c/src/windows/schannel.c
----------------------------------------------------------------------
diff --git a/proton-c/src/windows/schannel.c b/proton-c/src/windows/schannel.c
index 757a108..28550fb 100644
--- a/proton-c/src/windows/schannel.c
+++ b/proton-c/src/windows/schannel.c
@@ -283,6 +283,7 @@ struct pni_ssl_t {
   SecPkgContext_StreamSizes sc_sizes;
   pn_ssl_verify_mode_t verify_mode;
   win_credential_t *cred;
+  char *subject;
 };
 
 static inline pn_transport_t *get_transport_internal(pn_ssl_t *ssl)
@@ -728,6 +729,7 @@ void pn_ssl_free( pn_transport_t *transport)
   if (ssl->sc_inbuf) free((void *)ssl->sc_inbuf);
   if (ssl->sc_outbuf) free((void *)ssl->sc_outbuf);
   if (ssl->inbuf2) pn_buffer_free(ssl->inbuf2);
+  if (ssl->subject) free(ssl->subject);
 
   free(ssl);
 }
@@ -811,10 +813,39 @@ int pn_ssl_get_peer_hostname( pn_ssl_t *ssl0, char *hostname, size_t *bufsize )
   return 0;
 }
 
-const char* pn_ssl_get_remote_subject(pn_ssl_t *ssl)
+const char* pn_ssl_get_remote_subject(pn_ssl_t *ssl0)
 {
-  //TODO: actual implementation
-  return NULL;
+  // RFC 2253 compliant, but differs from openssl's subject string with space separators and
+  // ordering of multicomponent RDNs.  Made to work as similarly as possible with choice of flags.
+  pni_ssl_t *ssl = get_ssl_internal(ssl0);
+  if (!ssl || !SecIsValidHandle(&ssl->ctxt_handle))
+    return NULL;
+  if (!ssl->subject) {
+    SECURITY_STATUS status;
+    PCCERT_CONTEXT peer_cc = 0;
+    status = QueryContextAttributes(&ssl->ctxt_handle, SECPKG_ATTR_REMOTE_CERT_CONTEXT, &peer_cc);
+    if (status != SEC_E_OK) {
+      ssl_log_error_status(status, "can't obtain remote certificate subject");
+      return NULL;
+    }
+    DWORD flags = CERT_X500_NAME_STR | CERT_NAME_STR_REVERSE_FLAG;
+    DWORD strlen = CertNameToStr(peer_cc->dwCertEncodingType, &peer_cc->pCertInfo->Subject,
+                                 flags, NULL, 0);
+    if (strlen > 0) {
+      ssl->subject = (char*) malloc(strlen);
+      if (ssl->subject) {
+        DWORD len = CertNameToStr(peer_cc->dwCertEncodingType, &peer_cc->pCertInfo->Subject,
+                                  flags, ssl->subject, strlen);
+        if (len != strlen) {
+          free(ssl->subject);
+          ssl->subject = NULL;
+          ssl_log_error("pn_ssl_get_remote_subject failure in CertNameToStr");
+        }
+      }
+    }
+    CertFreeCertificateContext(peer_cc);
+  }
+  return ssl->subject;
 }
 
 
@@ -1678,16 +1709,16 @@ static ssize_t process_output_ssl( pn_transport_t *transport, unsigned int layer
 
     if (ssl->network_out_pending == 0) {
       if (ssl->state == SHUTTING_DOWN) {
-	if (!ssl->queued_shutdown) {
-	  start_ssl_shutdown(transport);
-	  work_pending = true;
-	} else {
-	  ssl->state = SSL_CLOSED;
-	}
+        if (!ssl->queued_shutdown) {
+          start_ssl_shutdown(transport);
+          work_pending = true;
+        } else {
+          ssl->state = SSL_CLOSED;
+        }
       }
       else if (ssl->state == NEGOTIATING && ssl->app_input_closed) {
-	ssl->app_output_closed = PN_EOS;
-	ssl->state = SSL_CLOSED;
+        ssl->app_output_closed = PN_EOS;
+        ssl->state = SSL_CLOSED;
       }
     }
   } while (work_pending);


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


[45/50] [abbrv] qpid-proton git commit: Merge branch 'master' into kgiusti-python3

Posted by kg...@apache.org.
Merge branch 'master' into kgiusti-python3


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

Branch: refs/heads/kgiusti-python3
Commit: 6069e1f4e974f261f23bbf45543733d9db003e7e
Parents: dff246b 98e27c6
Author: Ken Giusti <kg...@apache.org>
Authored: Thu Jun 18 13:55:06 2015 -0400
Committer: Ken Giusti <kg...@apache.org>
Committed: Thu Jun 18 13:55:06 2015 -0400

----------------------------------------------------------------------
 .travis.yml                                 |  12 +-
 proton-c/bindings/python/proton/__init__.py |   7 +-
 proton-c/bindings/ruby/CMakeLists.txt       |  18 ++-
 proton-c/include/proton/cproton.i           |   2 -
 proton-c/include/proton/transport.h         |  16 +-
 proton-c/src/engine/engine-internal.h       |  14 +-
 proton-c/src/engine/engine.c                |  16 +-
 proton-c/src/messenger/messenger.c          |   5 +-
 proton-c/src/sasl/cyrus_sasl.c              |   2 +-
 proton-c/src/sasl/sasl.c                    |   2 +-
 proton-c/src/transport/transport.c          | 124 +++++++++++++--
 tests/python/proton_tests/engine.py         |  48 +++++-
 tests/python/proton_tests/transport.py      | 190 +++++++++++++++++++++--
 13 files changed, 418 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6069e1f4/proton-c/bindings/python/proton/__init__.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6069e1f4/tests/python/proton_tests/engine.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6069e1f4/tests/python/proton_tests/transport.py
----------------------------------------------------------------------


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


[17/50] [abbrv] qpid-proton git commit: PROTON-866: Add support for EXTERNAL mechanism to default SASL impl

Posted by kg...@apache.org.
PROTON-866: Add support for EXTERNAL mechanism to default SASL impl


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

Branch: refs/heads/kgiusti-python3
Commit: 8108bd760914c362dde575ed700b744f5d415a3d
Parents: 060b1aa
Author: Andrew Stitcher <as...@apache.org>
Authored: Thu Jun 11 15:11:25 2015 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Thu Jun 11 15:14:49 2015 -0400

----------------------------------------------------------------------
 proton-c/src/sasl/none_sasl.c | 65 +++++++++++++++++++++++++++++++-------
 1 file changed, 53 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8108bd76/proton-c/src/sasl/none_sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/none_sasl.c b/proton-c/src/sasl/none_sasl.c
index 9e3de1d..4a2dc13 100644
--- a/proton-c/src/sasl/none_sasl.c
+++ b/proton-c/src/sasl/none_sasl.c
@@ -24,6 +24,7 @@
 #include "engine/engine-internal.h"
 
 static const char ANONYMOUS[] = "ANONYMOUS";
+static const char EXTERNAL[] = "EXTERNAL";
 static const char PLAIN[] = "PLAIN";
 
 bool pni_init_server(pn_transport_t* transport)
@@ -44,27 +45,53 @@ void pni_sasl_impl_free(pn_transport_t *transport)
 // Client handles ANONYMOUS or PLAIN mechanisms if offered
 bool pni_process_mechanisms(pn_transport_t *transport, const char *mechs)
 {
-  // Check whether offered ANONYMOUS or PLAIN
+  // Check whether offered EXTERNAL, PLAIN or ANONYMOUS
+  // Look for "EXTERNAL" in mechs
+  const char *found = strstr(mechs, EXTERNAL);
+  // Make sure that string is separated and terminated and allowed
+  if (found && (found==mechs || found[-1]==' ') && (found[8]==0 || found[8]==' ') &&
+      pni_included_mech(transport->sasl->included_mechanisms, pn_bytes(8, found))) {
+    transport->sasl->selected_mechanism = pn_strdup(EXTERNAL);
+    if (transport->sasl->username) {
+      size_t size = strlen(transport->sasl->username);
+      char *iresp = (char *) malloc(size);
+      if (!iresp) return false;
+
+      transport->sasl->impl_context = iresp;
+
+      memmove(iresp, transport->sasl->username, size);
+      transport->sasl->bytes_out.start = iresp;
+      transport->sasl->bytes_out.size =  size;
+    } else {
+      static const char empty[] = "";
+      transport->sasl->bytes_out.start = empty;
+      transport->sasl->bytes_out.size =  0;
+    }
+    return true;
+  }
+
   // Look for "PLAIN" in mechs
-  const char *found = strstr(mechs, PLAIN);
+  found = strstr(mechs, PLAIN);
   // Make sure that string is separated and terminated, allowed
-  // and we have a username and password
+  // and we have a username and password and connection is encrypted
   if (found && (found==mechs || found[-1]==' ') && (found[5]==0 || found[5]==' ') &&
       pni_included_mech(transport->sasl->included_mechanisms, pn_bytes(5, found)) &&
+      transport->sasl->external_ssf > 0 &&
       transport->sasl->username && transport->sasl->password) {
     transport->sasl->selected_mechanism = pn_strdup(PLAIN);
     size_t usize = strlen(transport->sasl->username);
     size_t psize = strlen(transport->sasl->password);
-    size_t size = usize + psize + 2;
+    size_t size = 2*usize + psize + 2;
     char *iresp = (char *) malloc(size);
     if (!iresp) return false;
 
     transport->sasl->impl_context = iresp;
 
-    iresp[0] = 0;
-    memmove(iresp + 1, transport->sasl->username, usize);
-    iresp[usize + 1] = 0;
-    memmove(iresp + usize + 2, transport->sasl->password, psize);
+    memmove(iresp, transport->sasl->username, usize);
+    iresp[usize] = 0;
+    memmove(iresp + usize + 1, transport->sasl->username, usize);
+    iresp[2*usize + 1] = 0;
+    memmove(iresp + 2*usize + 2, transport->sasl->password, psize);
     transport->sasl->bytes_out.start = iresp;
     transport->sasl->bytes_out.size =  size;
 
@@ -101,20 +128,34 @@ bool pni_process_mechanisms(pn_transport_t *transport, const char *mechs)
   return false;
 }
 
-// Server will offer only ANONYMOUS
+// Server will offer only ANONYMOUS and EXTERNAL if appropriate
 int pni_sasl_impl_list_mechs(pn_transport_t *transport, char **mechlist)
 {
-  *mechlist = pn_strdup("ANONYMOUS");
-  return 1;
+  // If we have an external authid then we can offer EXTERNAL
+  if (transport->sasl && transport->sasl->external_auth) {
+    *mechlist = pn_strdup("EXTERNAL ANONYMOUS");
+    return 2;
+  } else {
+    *mechlist = pn_strdup("ANONYMOUS");
+    return 1;
+  }
 }
 
 void pni_process_init(pn_transport_t *transport, const char *mechanism, const pn_bytes_t *recv)
 {
   // Check that mechanism is ANONYMOUS and it is allowed
-  if (strcmp(mechanism, "ANONYMOUS")==0 &&
+  if (strcmp(mechanism, ANONYMOUS)==0 &&
       pni_included_mech(transport->sasl->included_mechanisms, pn_bytes(sizeof(ANONYMOUS)-1, ANONYMOUS))) {
     transport->sasl->username = "anonymous";
     transport->sasl->outcome = PN_SASL_OK;
+    transport->authenticated = true;
+    pni_sasl_set_desired_state(transport, SASL_POSTED_OUTCOME);
+  } else if (strcmp(mechanism, EXTERNAL)==0 &&
+      transport->sasl->external_auth &&
+      pni_included_mech(transport->sasl->included_mechanisms, pn_bytes(sizeof(EXTERNAL)-1, EXTERNAL))) {
+    transport->sasl->username = transport->sasl->external_auth;
+    transport->sasl->outcome = PN_SASL_OK;
+    transport->authenticated = true;
     pni_sasl_set_desired_state(transport, SASL_POSTED_OUTCOME);
   } else {
     transport->sasl->outcome = PN_SASL_AUTH;


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


[49/50] [abbrv] qpid-proton git commit: PROTON-490: transport I/O is binary, not str

Posted by kg...@apache.org.
PROTON-490: transport I/O is binary, not str


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

Branch: refs/heads/kgiusti-python3
Commit: 35eb6bb3332c8965f4fe1434c30517238a52a0bb
Parents: cb59c19
Author: Ken Giusti <kg...@apache.org>
Authored: Thu Jun 18 16:09:05 2015 -0400
Committer: Ken Giusti <kg...@apache.org>
Committed: Thu Jun 18 16:09:05 2015 -0400

----------------------------------------------------------------------
 tests/python/proton_tests/transport.py | 32 +++++++++++++++--------------
 1 file changed, 17 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/35eb6bb3/tests/python/proton_tests/transport.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/transport.py b/tests/python/proton_tests/transport.py
index dd02c81..07268e1 100644
--- a/tests/python/proton_tests/transport.py
+++ b/tests/python/proton_tests/transport.py
@@ -90,11 +90,11 @@ class ClientTransportTest(Test):
     self.assert_error(u'amqp:connection:framing-error')
 
   def testProtocolNotSupported(self):
-    self.transport.push("AMQP\x01\x01\x0a\x00")
+    self.transport.push(str2bin("AMQP\x01\x01\x0a\x00"))
     p = self.transport.pending()
     assert p >= 8, p
     bytes = self.transport.peek(p)
-    assert bytes[:8] == "AMQP\x00\x01\x00\x00"
+    assert bytes[:8] == str2bin("AMQP\x00\x01\x00\x00")
     self.transport.pop(p)
     self.drain()
     assert self.transport.closed
@@ -214,29 +214,29 @@ class ServerTransportTest(Test):
 
   # TODO: This may no longer be testing anything
   def testEOS(self):
-    self.transport.push("") # should be a noop
+    self.transport.push(str2bin("")) # should be a noop
     self.transport.close_tail()
     p = self.transport.pending()
     self.drain()
     assert self.transport.closed
 
   def testPartial(self):
-    self.transport.push("AMQ") # partial header
+    self.transport.push(str2bin("AMQ")) # partial header
     self.transport.close_tail()
     p = self.transport.pending()
     assert p >= 8, p
     bytes = self.transport.peek(p)
-    assert bytes[:8] == "AMQP\x00\x01\x00\x00"
+    assert bytes[:8] == str2bin("AMQP\x00\x01\x00\x00")
     self.transport.pop(p)
     self.drain()
     assert self.transport.closed
 
   def testGarbage(self, garbage="GARBAGE_"):
-    self.transport.push(garbage)
+    self.transport.push(str2bin(garbage))
     p = self.transport.pending()
     assert p >= 8, p
     bytes = self.transport.peek(p)
-    assert bytes[:8] == "AMQP\x00\x01\x00\x00"
+    assert bytes[:8] == str2bin("AMQP\x00\x01\x00\x00")
     self.transport.pop(p)
     self.drain()
     assert self.transport.closed
@@ -248,16 +248,16 @@ class ServerTransportTest(Test):
     self.testGarbage("GARBAGE_XXX")
 
   def testHeader(self):
-    self.transport.push("AMQP\x00\x01\x00\x00")
+    self.transport.push(str2bin("AMQP\x00\x01\x00\x00"))
     self.transport.close_tail()
     self.assert_error(u'amqp:connection:framing-error')
 
   def testProtocolNotSupported(self):
-    self.transport.push("AMQP\x01\x01\x0a\x00")
+    self.transport.push(str2bin("AMQP\x01\x01\x0a\x00"))
     p = self.transport.pending()
     assert p >= 8, p
     bytes = self.transport.peek(p)
-    assert bytes[:8] == "AMQP\x00\x01\x00\x00"
+    assert bytes[:8] == str2bin("AMQP\x00\x01\x00\x00")
     self.transport.pop(p)
     self.drain()
     assert self.transport.closed
@@ -276,8 +276,8 @@ class ServerTransportTest(Test):
     trn = Transport()
     trn.bind(conn)
     out = trn.peek(1024)
-    assert "test-container" in out, repr(out)
-    assert "test-hostname" in out, repr(out)
+    assert str2bin("test-container") in out, repr(out)
+    assert str2bin("test-hostname") in out, repr(out)
     self.transport.push(out)
 
     c = Connection()
@@ -294,7 +294,8 @@ class ServerTransportTest(Test):
     assert n >= 0, n
     try:
       self.transport.close_head()
-    except TransportException, e:
+    except TransportException:
+      e = sys.exc_info()[1]
       assert "aborted" in str(e), str(e)
     n = self.transport.pending()
     assert n < 0, n
@@ -304,7 +305,8 @@ class ServerTransportTest(Test):
     assert n > 0, n
     try:
       self.transport.close_tail()
-    except TransportException, e:
+    except TransportException:
+      e = sys.exc_info()[1]
       assert "aborted" in str(e), str(e)
     n = self.transport.capacity()
     assert n < 0, n
@@ -332,7 +334,7 @@ class ServerTransportTest(Test):
     self.transport.pop(len(dat2) - len(dat1))
     dat3 = self.transport.peek(1024)
     self.transport.pop(len(dat3))
-    assert self.transport.peek(1024) == ""
+    assert self.transport.peek(1024) == str2bin("")
 
     self.peer.push(dat1)
     self.peer.push(dat2[len(dat1):])


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


[29/50] [abbrv] qpid-proton git commit: PROTON-895: missing errno import

Posted by kg...@apache.org.
PROTON-895: missing errno import


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

Branch: refs/heads/kgiusti-python3
Commit: 821b4e1e96b0d449a925272e4fad713f9d42485b
Parents: 2117b3b
Author: Flavio Percoco <fl...@gmail.com>
Authored: Tue Jun 16 09:37:16 2015 +0200
Committer: Ken Giusti <kg...@apache.org>
Committed: Tue Jun 16 12:05:46 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/python/setuputils/misc.py | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/821b4e1e/proton-c/bindings/python/setuputils/misc.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/setuputils/misc.py b/proton-c/bindings/python/setuputils/misc.py
index cf6b97f..3a32165 100644
--- a/proton-c/bindings/python/setuputils/misc.py
+++ b/proton-c/bindings/python/setuputils/misc.py
@@ -12,6 +12,7 @@
 #-----------------------------------------------------------------------------
 
 
+import errno
 import os
 import subprocess
 import sys


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


[22/50] [abbrv] qpid-proton git commit: PROTON-895: Let tox handle sdist and install steps (patch from Flavio Percoco).

Posted by kg...@apache.org.
PROTON-895: Let tox handle sdist and install steps (patch from Flavio Percoco).

Since we're not using cmake anymore, we can let tox handle the sdist and
install steps so that everything happens within the tox venv.


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

Branch: refs/heads/kgiusti-python3
Commit: f6e1948c840e819ef264303b012aa450e2988f8a
Parents: 990b11e
Author: Gordon Sim <gs...@redhat.com>
Authored: Fri Jun 12 13:55:47 2015 +0100
Committer: Gordon Sim <gs...@redhat.com>
Committed: Fri Jun 12 13:55:47 2015 +0100

----------------------------------------------------------------------
 proton-c/bindings/python/tox.ini | 4 ----
 1 file changed, 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f6e1948c/proton-c/bindings/python/tox.ini
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/tox.ini b/proton-c/bindings/python/tox.ini
index aab5e4e..dddfe74 100644
--- a/proton-c/bindings/python/tox.ini
+++ b/proton-c/bindings/python/tox.ini
@@ -22,15 +22,11 @@ commands = python setup.py build_sphinx
 
 [testenv:build]
 usedevelop = False
-skipdist = True
-changedir = {toxinidir}
 platform = linux2
-skip_install = True
 setenv =
     VIRTUAL_ENV={envdir}
     PKG_CONFIG_PATH=None
     QPID_PROTON_SRC={toxinidir}/../../../
     DEBUG=True
 commands =
-    {envbindir}/python setup.py build -b {envbindir}/build install
     {toxinidir}/../../../tests/python/proton-test {posargs}
\ No newline at end of file


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


[40/50] [abbrv] qpid-proton git commit: NO-JIRA: add ruby-dev and python-dev to travis

Posted by kg...@apache.org.
NO-JIRA: add ruby-dev and python-dev to travis


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

Branch: refs/heads/kgiusti-python3
Commit: 83f424f5dc7789cc8dce7e7a96dde63dd415b478
Parents: 3aab9a0
Author: Dominic Evans <do...@uk.ibm.com>
Authored: Wed Jun 17 16:03:43 2015 +0100
Committer: Dominic Evans <do...@uk.ibm.com>
Committed: Thu Jun 18 10:52:04 2015 +0100

----------------------------------------------------------------------
 .travis.yml | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/83f424f5/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 7493ca2..6d1a73e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,12 @@
+---
 language: c
 install:
-  - sudo apt-get update -qq
-  - sudo apt-get install -y -qq bash cmake libssl-dev maven ruby python php5 openjdk-7-jdk swig uuid-dev valgrind libsasl2-dev sasl2-bin
+- sudo apt-get update -qq
+- sudo apt-get install -y -qq bash cmake libssl-dev maven ruby ruby-dev
+    python python-dev php5 openjdk-7-jdk swig uuid-dev valgrind libsasl2-dev
+    sasl2-bin
+- gem install rspec simplecov
 script:
-  - bin/jenkins-proton-c-build.sh
+- bin/jenkins-proton-c-build.sh
+os:
+- linux


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


[47/50] [abbrv] qpid-proton git commit: PROTON-490: Check on linux|linux2 in the setup.py

Posted by kg...@apache.org.
PROTON-490: Check on linux|linux2 in the setup.py

(cherry picked from commit cf3acf7cf9b7a06dbbcc5afee4ec6df2ec66e488)


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

Branch: refs/heads/kgiusti-python3
Commit: 13546483d2e1cdc26a2d941763db078a07e54d0d
Parents: 13cc729
Author: Flavio Percoco <fl...@gmail.com>
Authored: Thu Jun 18 11:34:51 2015 +0200
Committer: Ken Giusti <kg...@apache.org>
Committed: Thu Jun 18 14:00:47 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/python/setup.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/13546483/proton-c/bindings/python/setup.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/setup.py b/proton-c/bindings/python/setup.py
index 1620b38..4cdd721 100755
--- a/proton-c/bindings/python/setup.py
+++ b/proton-c/bindings/python/setup.py
@@ -335,7 +335,8 @@ class Configure(build_ext):
         return not self.check_qpid_proton_version()
 
     def run(self):
-        if sys.platform == 'linux2':
+        # linux2 for python<3.0
+        if sys.platform in ['linux', 'linux2']:
             if self.bundle_proton:
                 self.bundle_libqpid_proton_extension()
 


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


[27/50] [abbrv] qpid-proton git commit: PROTON-490: fix some py34 incompatibilities

Posted by kg...@apache.org.
PROTON-490: fix some py34 incompatibilities


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

Branch: refs/heads/kgiusti-python3
Commit: ce45c3a4bfc4174258ae0c681c883fb27e43404a
Parents: fc3f4f5
Author: Flavio Percoco <fl...@gmail.com>
Authored: Sun Jun 14 00:39:41 2015 +0200
Committer: Ken Giusti <kg...@apache.org>
Committed: Mon Jun 15 13:37:25 2015 -0400

----------------------------------------------------------------------
 tests/python/proton_tests/engine.py | 16 ++++++++--------
 tests/python/proton_tests/sasl.py   |  2 --
 2 files changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ce45c3a4/tests/python/proton_tests/engine.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/engine.py b/tests/python/proton_tests/engine.py
index 143e7d5..fcc648e 100644
--- a/tests/python/proton_tests/engine.py
+++ b/tests/python/proton_tests/engine.py
@@ -2533,10 +2533,10 @@ class SaslEventTest(CollectorTest):
     s.allowed_mechs("ANONYMOUS PLAIN")
     transport.bind(conn)
     self.expect(Event.CONNECTION_INIT, Event.CONNECTION_BOUND)
-    transport.push('AMQP\x03\x01\x00\x00\x00\x00\x00\x1c\x02\x01\x00\x00\x00S@'
-                   '\xc0\x0f\x01\xe0\x0c\x01\xa3\tANONYMOUS\x00\x00\x00\x10'
-                   '\x02\x01\x00\x00\x00SD\xc0\x03\x01P\x00AMQP\x00\x01\x00'
-                   '\x00')
+    transport.push(str2bin('AMQP\x03\x01\x00\x00\x00\x00\x00\x1c\x02\x01\x00\x00\x00S@'
+                           '\xc0\x0f\x01\xe0\x0c\x01\xa3\tANONYMOUS\x00\x00\x00\x10'
+                           '\x02\x01\x00\x00\x00SD\xc0\x03\x01P\x00AMQP\x00\x01\x00'
+                           '\x00'))
     self.expect(Event.TRANSPORT)
     p = transport.pending()
     bytes = transport.peek(p)
@@ -2559,10 +2559,10 @@ class SaslEventTest(CollectorTest):
     bytes = transport.peek(p)
     transport.pop(p)
     self.expect(Event.CONNECTION_INIT, Event.CONNECTION_BOUND, Event.TRANSPORT)
-    transport.push('AMQP\x03\x01\x00\x00\x00\x00\x00\x1c\x02\x01\x00\x00\x00S@'
-                   '\xc0\x0f\x01\xe0\x0c\x01\xa3\tANONYMOUS\x00\x00\x00\x10'
-                   '\x02\x01\x00\x00\x00SD\xc0\x03\x01P\x00AMQP\x00\x01\x00'
-                   '\x00')
+    transport.push(str2bin('AMQP\x03\x01\x00\x00\x00\x00\x00\x1c\x02\x01\x00\x00\x00S@'
+                           '\xc0\x0f\x01\xe0\x0c\x01\xa3\tANONYMOUS\x00\x00\x00\x10'
+                           '\x02\x01\x00\x00\x00SD\xc0\x03\x01P\x00AMQP\x00\x01\x00'
+                           '\x00'))
     self.expect(Event.TRANSPORT)
     p = transport.pending()
     bytes = transport.peek(p)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ce45c3a4/tests/python/proton_tests/sasl.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/sasl.py b/tests/python/proton_tests/sasl.py
index b214b62..b4e9c7a 100644
--- a/tests/python/proton_tests/sasl.py
+++ b/tests/python/proton_tests/sasl.py
@@ -27,8 +27,6 @@ from proton import *
 from .common import pump, Skipped
 from proton._compat import str2bin
 
-from cproton import *
-
 def _sslCertpath(file):
     """ Return the full path to the certificate,keyfile, etc.
     """


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


[43/50] [abbrv] qpid-proton git commit: PROTON-904: provide a better seed to srand()

Posted by kg...@apache.org.
PROTON-904: provide a better seed to srand()


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

Branch: refs/heads/kgiusti-python3
Commit: 824dfefd53ad88f305816273f9896f91dddc5d08
Parents: e38957a
Author: Ken Giusti <kg...@apache.org>
Authored: Thu Jun 18 13:31:06 2015 -0400
Committer: Ken Giusti <kg...@apache.org>
Committed: Thu Jun 18 13:31:06 2015 -0400

----------------------------------------------------------------------
 proton-c/src/messenger/messenger.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/824dfefd/proton-c/src/messenger/messenger.c
----------------------------------------------------------------------
diff --git a/proton-c/src/messenger/messenger.c b/proton-c/src/messenger/messenger.c
index ec4fb2c..9749bf5 100644
--- a/proton-c/src/messenger/messenger.c
+++ b/proton-c/src/messenger/messenger.c
@@ -503,7 +503,10 @@ static char *build_name(const char *name)
 
   if (!seeded) {
     int pid = pn_i_getpid();
-    srand(pn_i_now() + pid);
+    int nowish = (int)pn_i_now();
+    // the lower bits of time are the most random, shift pid to push some
+    // randomness into the higher order bits
+    srand(nowish ^ (pid<<16));
     seeded = true;
   }
 


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


[03/50] [abbrv] qpid-proton git commit: PROTON-897: Renamed passive_recv.rb to nonblocking_recv.rb

Posted by kg...@apache.org.
PROTON-897: Renamed passive_recv.rb to nonblocking_recv.rb

The name is a little more specific as to what the example shows.


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

Branch: refs/heads/kgiusti-python3
Commit: 267072da7de4d24cad7f9838b917160b3135bd13
Parents: ac4731f
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Mon Jun 1 11:36:15 2015 -0400
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 4 08:28:46 2015 -0400

----------------------------------------------------------------------
 examples/ruby/messenger/nonblocking_recv.rb | 140 +++++++++++++++++++++++
 examples/ruby/messenger/passive_recv.rb     | 140 -----------------------
 2 files changed, 140 insertions(+), 140 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/267072da/examples/ruby/messenger/nonblocking_recv.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/messenger/nonblocking_recv.rb b/examples/ruby/messenger/nonblocking_recv.rb
new file mode 100644
index 0000000..d1fa854
--- /dev/null
+++ b/examples/ruby/messenger/nonblocking_recv.rb
@@ -0,0 +1,140 @@
+#!/usr/bin/env ruby
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+require 'qpid_proton'
+require 'optparse'
+
+addresses = []
+
+OptionParser.new do |opts|
+  opts.banner = "Usage: recv.rb <addr1> ... <addrn>"
+  opts.parse!
+
+  addresses = ARGV
+end
+
+addresses = ["~0.0.0.0"] if addresses.empty?
+
+messenger = Qpid::Proton::Messenger::Messenger.new
+messenger.passive = true
+
+begin
+  messenger.start
+rescue ProtonError => error
+  puts "ERROR: #{error.message}"
+  puts error.backtrace.join("\n")
+  exit
+end
+
+addresses.each do |address|
+  begin
+    messenger.subscribe(address)
+  rescue Qpid::Proton::ProtonError => error
+    puts "ERROR: #{error.message}"
+    exit
+  end
+end
+
+msg = Qpid::Proton::Message.new
+
+read_array = []
+write_array = []
+selectables = {}
+
+loop do
+
+  # wait for incoming messages
+  sel = messenger.selectable
+  while !sel.nil?
+    if sel.terminal?
+      selectables.delete(sel.fileno)
+      read_array.delete(sel)
+      write_array.delete(sel)
+      sel.free
+    else
+      sel.capacity
+      sel.pending
+      if !sel.registered?
+        read_array << sel
+        write_array << sel
+        selectables[sel.fileno] = sel
+        sel.registered = true
+      end
+    end
+    sel = messenger.selectable
+  end
+
+  unless selectables.empty?
+    rarray = []; read_array.each {|fd| rarray << fd.to_io }
+    warray = []; write_array.each {|fd| warray << fd.to_io }
+
+    if messenger.deadline > 0.0
+      result = IO.select(rarray, warray, nil, messenger.deadline)
+    else
+      result = IO.select(rarray, warray)
+    end
+
+    unless result.nil? && result.empty?
+      result.flatten.each do |io|
+        sel = selectables[io.fileno]
+
+        sel.writable if sel.pending > 0
+        sel.readable if sel.capacity > 0
+      end
+    end
+
+    begin
+      messenger.receive(10)
+    rescue Qpid::Proton::ProtonError => error
+      puts "ERROR: #{error.message}"
+      exit
+    end
+
+    while messenger.incoming.nonzero?
+      begin
+        messenger.get(msg)
+      rescue Qpid::Proton::Error => error
+        puts "ERROR: #{error.message}"
+        exit
+      end
+
+      puts "Address: #{msg.address}"
+      subject = msg.subject || "(no subject)"
+      puts "Subject: #{subject}"
+      puts "Body: #{msg.body}"
+      puts "Properties: #{msg.properties}"
+      puts "Instructions: #{msg.instructions}"
+      puts "Annotations: #{msg.annotations}"
+
+      if msg.reply_to
+        puts "=== Sending a reply to #{msg.reply_to}"
+        reply = Qpid::Proton::Message.new
+        reply.address = msg.reply_to
+        reply.subject = "RE: #{msg.subject}"
+        reply.content = "Thanks for the message!"
+
+        messenger.put(reply)
+        messenger.send
+      end
+    end
+  end
+end
+
+messenger.stop
+

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/267072da/examples/ruby/messenger/passive_recv.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/messenger/passive_recv.rb b/examples/ruby/messenger/passive_recv.rb
deleted file mode 100644
index d1fa854..0000000
--- a/examples/ruby/messenger/passive_recv.rb
+++ /dev/null
@@ -1,140 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require 'qpid_proton'
-require 'optparse'
-
-addresses = []
-
-OptionParser.new do |opts|
-  opts.banner = "Usage: recv.rb <addr1> ... <addrn>"
-  opts.parse!
-
-  addresses = ARGV
-end
-
-addresses = ["~0.0.0.0"] if addresses.empty?
-
-messenger = Qpid::Proton::Messenger::Messenger.new
-messenger.passive = true
-
-begin
-  messenger.start
-rescue ProtonError => error
-  puts "ERROR: #{error.message}"
-  puts error.backtrace.join("\n")
-  exit
-end
-
-addresses.each do |address|
-  begin
-    messenger.subscribe(address)
-  rescue Qpid::Proton::ProtonError => error
-    puts "ERROR: #{error.message}"
-    exit
-  end
-end
-
-msg = Qpid::Proton::Message.new
-
-read_array = []
-write_array = []
-selectables = {}
-
-loop do
-
-  # wait for incoming messages
-  sel = messenger.selectable
-  while !sel.nil?
-    if sel.terminal?
-      selectables.delete(sel.fileno)
-      read_array.delete(sel)
-      write_array.delete(sel)
-      sel.free
-    else
-      sel.capacity
-      sel.pending
-      if !sel.registered?
-        read_array << sel
-        write_array << sel
-        selectables[sel.fileno] = sel
-        sel.registered = true
-      end
-    end
-    sel = messenger.selectable
-  end
-
-  unless selectables.empty?
-    rarray = []; read_array.each {|fd| rarray << fd.to_io }
-    warray = []; write_array.each {|fd| warray << fd.to_io }
-
-    if messenger.deadline > 0.0
-      result = IO.select(rarray, warray, nil, messenger.deadline)
-    else
-      result = IO.select(rarray, warray)
-    end
-
-    unless result.nil? && result.empty?
-      result.flatten.each do |io|
-        sel = selectables[io.fileno]
-
-        sel.writable if sel.pending > 0
-        sel.readable if sel.capacity > 0
-      end
-    end
-
-    begin
-      messenger.receive(10)
-    rescue Qpid::Proton::ProtonError => error
-      puts "ERROR: #{error.message}"
-      exit
-    end
-
-    while messenger.incoming.nonzero?
-      begin
-        messenger.get(msg)
-      rescue Qpid::Proton::Error => error
-        puts "ERROR: #{error.message}"
-        exit
-      end
-
-      puts "Address: #{msg.address}"
-      subject = msg.subject || "(no subject)"
-      puts "Subject: #{subject}"
-      puts "Body: #{msg.body}"
-      puts "Properties: #{msg.properties}"
-      puts "Instructions: #{msg.instructions}"
-      puts "Annotations: #{msg.annotations}"
-
-      if msg.reply_to
-        puts "=== Sending a reply to #{msg.reply_to}"
-        reply = Qpid::Proton::Message.new
-        reply.address = msg.reply_to
-        reply.subject = "RE: #{msg.subject}"
-        reply.content = "Thanks for the message!"
-
-        messenger.put(reply)
-        messenger.send
-      end
-    end
-  end
-end
-
-messenger.stop
-


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


[02/50] [abbrv] qpid-proton git commit: PROTON-334: Mark transport as authenticated on client side - Make sure we don't send init SASL frames if an error happened

Posted by kg...@apache.org.
PROTON-334: Mark transport as authenticated on client side
- Make sure we don't send init SASL frames if an error happened


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

Branch: refs/heads/kgiusti-python3
Commit: 89ef63b46f35c6916f1e134a500fdf372bb5438d
Parents: cedb476
Author: Andrew Stitcher <as...@apache.org>
Authored: Wed Jun 3 11:06:37 2015 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Thu Jun 4 00:10:27 2015 -0400

----------------------------------------------------------------------
 proton-c/src/sasl/sasl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/89ef63b4/proton-c/src/sasl/sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/sasl.c b/proton-c/src/sasl/sasl.c
index c425490..e180280 100644
--- a/proton-c/src/sasl/sasl.c
+++ b/proton-c/src/sasl/sasl.c
@@ -338,7 +338,7 @@ static void pni_post_sasl_frame(pn_transport_t *transport)
       pni_emit(transport);
       break;
     case SASL_RECVED_OUTCOME:
-      if (sasl->last_state < SASL_POSTED_INIT) {
+      if (sasl->last_state < SASL_POSTED_INIT && sasl->outcome==PN_SASL_OK) {
         desired_state = SASL_POSTED_INIT;
         continue;
       }
@@ -620,6 +620,7 @@ int pn_do_outcome(pn_transport_t *transport, uint8_t frame_type, uint16_t channe
 
   pni_sasl_t *sasl = transport->sasl;
   sasl->outcome = (pn_sasl_outcome_t) outcome;
+  transport->authenticated = sasl->outcome==PN_SASL_OK;
   pni_sasl_set_desired_state(transport, SASL_RECVED_OUTCOME);
 
   return 0;


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


[24/50] [abbrv] qpid-proton git commit: PROTON-913: cannot use NULL as first param for pn_transport_log()

Posted by kg...@apache.org.
PROTON-913: cannot use NULL as first param for pn_transport_log()


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

Branch: refs/heads/kgiusti-python3
Commit: c2c178c9ce4bbad7b81e925a3f49f5e80fe60e62
Parents: 75fc98f
Author: Gordon Sim <gs...@redhat.com>
Authored: Fri Jun 12 20:28:05 2015 +0100
Committer: Gordon Sim <gs...@redhat.com>
Committed: Fri Jun 12 20:28:05 2015 +0100

----------------------------------------------------------------------
 proton-c/src/ssl/openssl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c2c178c9/proton-c/src/ssl/openssl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/ssl/openssl.c b/proton-c/src/ssl/openssl.c
index 52eac01..a5aee8b 100644
--- a/proton-c/src/ssl/openssl.c
+++ b/proton-c/src/ssl/openssl.c
@@ -730,7 +730,7 @@ int pn_ssl_domain_allow_unsecured_client(pn_ssl_domain_t *domain)
 {
   if (!domain) return -1;
   if (domain->mode != PN_SSL_MODE_SERVER) {
-    pn_transport_log(NULL, "Cannot permit unsecured clients - not a server.");
+    pn_transport_logf(NULL, "Cannot permit unsecured clients - not a server.");
     return -1;
   }
   domain->allow_unsecured = true;


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


[48/50] [abbrv] qpid-proton git commit: PROTON-490: Support for py26

Posted by kg...@apache.org.
PROTON-490: Support for py26

(cherry picked from commit c5b7f543a52f4d1f0fbe384b6244528f5ee38266)


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

Branch: refs/heads/kgiusti-python3
Commit: cb59c19abce5e3fa3879d54bff4ecb2e9bc0f136
Parents: 1354648
Author: Flavio Percoco <fl...@gmail.com>
Authored: Thu Jun 18 15:52:40 2015 +0200
Committer: Ken Giusti <kg...@apache.org>
Committed: Thu Jun 18 14:01:04 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/python/setup.py | 7 ++++---
 proton-c/bindings/python/tox.ini  | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cb59c19a/proton-c/bindings/python/setup.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/setup.py b/proton-c/bindings/python/setup.py
index 4cdd721..1eb3e64 100755
--- a/proton-c/bindings/python/setup.py
+++ b/proton-c/bindings/python/setup.py
@@ -315,7 +315,7 @@ class Configure(build_ext):
 
         _cproton.runtime_library_dirs.extend([install_lib])
 
-        if sys.version_info.major >= 3:
+        if sys.version_info[0] >= 3:
             _cproton.libraries[0] = "qpid-proton%s" % ds_sys.get_config_var('EXT_SUFFIX')[:-3]
 
         # Register this new extension and make
@@ -335,8 +335,9 @@ class Configure(build_ext):
         return not self.check_qpid_proton_version()
 
     def run(self):
-        # linux2 for python<3.0
-        if sys.platform in ['linux', 'linux2']:
+        # linux2 for python<2.7
+        # linux4 for python<2.6
+        if sys.platform in ['linux', 'linux2', 'linux4']:
             if self.bundle_proton:
                 self.bundle_libqpid_proton_extension()
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cb59c19a/proton-c/bindings/python/tox.ini
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/tox.ini b/proton-c/bindings/python/tox.ini
index 8a8c87c..2bb26a6 100644
--- a/proton-c/bindings/python/tox.ini
+++ b/proton-c/bindings/python/tox.ini
@@ -1,5 +1,5 @@
 [tox]
-envlist = py27,py33,py34
+envlist = py26,py27,py33,py34
 minversion = 1.4
 skipdist = True
 


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