PROTON-1350 PROTON-1351: Introduce proton-c core library - Created new core proton library qpid-proton-core which only contains protocol processsing and no IO. - Rearranged source tree to separate core protocol code and io/reactor/extra code - Rearranged code so that compiler dependent code is isolated and platform (OS) dependent code is isolated
This is a large change, but the majority is moving files around and fixing up the header includes. There is a small amount of internal API changing so support the core searation. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/a5850716 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/a5850716 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/a5850716 Branch: refs/heads/master Commit: a58507161cb839d14ecd3c36477747de59725554 Parents: efd033c Author: Andrew Stitcher <[email protected]> Authored: Mon Nov 14 12:55:01 2016 -0500 Committer: Andrew Stitcher <[email protected]> Committed: Mon Nov 14 12:55:01 2016 -0500 ---------------------------------------------------------------------- proton-c/CMakeLists.txt | 162 +- proton-c/bindings/python/proton/reactor.py | 4 +- proton-c/bindings/python/setup.py | 10 +- proton-c/bindings/ruby/lib/reactor/reactor.rb | 6 +- proton-c/include/proton/cproton.i | 2 - proton-c/include/proton/event.h | 5 - proton-c/include/proton/handlers.h | 6 +- proton-c/include/proton/import_export.h | 10 +- proton-c/include/proton/io.h | 114 - proton-c/include/proton/messenger.h | 124 +- proton-c/include/proton/reactor.h | 112 +- proton-c/include/proton/scanner.h | 82 - proton-c/include/proton/selectable.h | 89 +- proton-c/include/proton/selector.h | 51 - proton-c/include/proton/types.h | 4 - proton-c/include/proton/url.h | 34 +- proton-c/src/ProtonConfig.cmake.in | 3 + proton-c/src/buffer.c | 310 -- proton-c/src/buffer.h | 54 - proton-c/src/codec/codec.c | 2142 ------------- proton-c/src/codec/data.h | 75 - proton-c/src/codec/decoder.c | 497 --- proton-c/src/codec/decoder.h | 30 - proton-c/src/codec/encoder.c | 383 --- proton-c/src/codec/encoder.h | 31 - proton-c/src/codec/encodings.h.py | 42 - proton-c/src/codec/types.xml | 125 - proton-c/src/compiler/msvc/snprintf.c | 52 + proton-c/src/config.h | 32 - proton-c/src/core/autodetect.c | 135 + proton-c/src/core/autodetect.h | 40 + proton-c/src/core/buffer.c | 310 ++ proton-c/src/core/buffer.h | 54 + proton-c/src/core/codec.c | 2141 +++++++++++++ proton-c/src/core/config.h | 32 + proton-c/src/core/connection_engine.c | 124 + proton-c/src/core/data.h | 75 + proton-c/src/core/decoder.c | 497 +++ proton-c/src/core/decoder.h | 30 + proton-c/src/core/dispatch_actions.h | 49 + proton-c/src/core/dispatcher.c | 158 + proton-c/src/core/dispatcher.h | 37 + proton-c/src/core/encoder.c | 383 +++ proton-c/src/core/encoder.h | 31 + proton-c/src/core/engine-internal.h | 375 +++ proton-c/src/core/engine.c | 2231 +++++++++++++ proton-c/src/core/error.c | 136 + proton-c/src/core/event.c | 377 +++ proton-c/src/core/framing.c | 103 + proton-c/src/core/framing.h | 44 + proton-c/src/core/log.c | 71 + proton-c/src/core/log_private.h | 54 + proton-c/src/core/message.c | 862 +++++ proton-c/src/core/object/iterator.c | 78 + proton-c/src/core/object/list.c | 267 ++ proton-c/src/core/object/map.c | 461 +++ proton-c/src/core/object/object.c | 312 ++ proton-c/src/core/object/record.c | 153 + proton-c/src/core/object/string.c | 269 ++ proton-c/src/core/transport.c | 3019 ++++++++++++++++++ proton-c/src/core/transport.h | 31 + proton-c/src/core/types.c | 34 + proton-c/src/core/util.c | 165 + proton-c/src/core/util.h | 123 + proton-c/src/dispatch_actions.h | 49 - proton-c/src/dispatcher/dispatcher.c | 158 - proton-c/src/dispatcher/dispatcher.h | 37 - proton-c/src/encodings.h.py | 42 + proton-c/src/engine/connection_engine.c | 124 - proton-c/src/engine/engine-internal.h | 374 --- proton-c/src/engine/engine.c | 2231 ------------- proton-c/src/error.c | 135 - proton-c/src/events/event.c | 388 --- proton-c/src/extra/parser.c | 423 +++ proton-c/src/extra/scanner.c | 399 +++ proton-c/src/extra/scanner.h | 74 + proton-c/src/extra/url.c | 272 ++ proton-c/src/framing/framing.c | 103 - proton-c/src/framing/framing.h | 52 - proton-c/src/handlers/iohandler.c | 7 +- proton-c/src/libqpid-proton-core.pc.in | 30 + proton-c/src/log.c | 70 - proton-c/src/log_private.h | 54 - proton-c/src/message/message.c | 861 ----- proton-c/src/messenger/messenger.c | 18 +- proton-c/src/messenger/store.c | 2 +- proton-c/src/messenger/store.h | 2 +- proton-c/src/messenger/transform.h | 3 +- proton-c/src/object/iterator.c | 78 - proton-c/src/object/list.c | 267 -- proton-c/src/object/map.c | 461 --- proton-c/src/object/object.c | 312 -- proton-c/src/object/record.c | 153 - proton-c/src/object/string.c | 270 -- proton-c/src/parser.c | 420 --- proton-c/src/platform.c | 134 - proton-c/src/platform.h | 101 - proton-c/src/platform/platform.c | 122 + proton-c/src/platform/platform.h | 93 + proton-c/src/platform/platform_fmt.h | 85 + proton-c/src/platform_fmt.h | 85 - proton-c/src/posix/io.c | 342 -- proton-c/src/posix/selector.c | 211 -- proton-c/src/reactor/acceptor.c | 13 +- proton-c/src/reactor/connection.c | 19 +- proton-c/src/reactor/io.h | 70 + proton-c/src/reactor/io/posix/io.c | 342 ++ proton-c/src/reactor/io/posix/selector.c | 214 ++ proton-c/src/reactor/io/windows/io.c | 459 +++ proton-c/src/reactor/io/windows/iocp.c | 1179 +++++++ proton-c/src/reactor/io/windows/iocp.h | 136 + proton-c/src/reactor/io/windows/selector.c | 384 +++ .../src/reactor/io/windows/write_pipeline.c | 314 ++ proton-c/src/reactor/reactor.c | 23 +- proton-c/src/reactor/reactor.h | 2 +- proton-c/src/reactor/selectable.c | 300 ++ proton-c/src/reactor/selectable.h | 36 + proton-c/src/reactor/selector.h | 53 + proton-c/src/sasl/cyrus_sasl.c | 4 +- proton-c/src/sasl/none_sasl.c | 2 +- proton-c/src/sasl/sasl-internal.h | 5 +- proton-c/src/sasl/sasl.c | 9 +- proton-c/src/scanner.c | 397 --- proton-c/src/selectable.c | 297 -- proton-c/src/selectable.h | 36 - proton-c/src/ssl/openssl.c | 13 +- proton-c/src/ssl/schannel.c | 2239 +++++++++++++ proton-c/src/ssl/ssl_stub.c | 2 +- proton-c/src/tests/data.c | 2 +- proton-c/src/transport/autodetect.c | 135 - proton-c/src/transport/autodetect.h | 40 - proton-c/src/transport/transport.c | 3018 ----------------- proton-c/src/transport/transport.h | 31 - proton-c/src/types.c | 41 - proton-c/src/types.xml | 125 + proton-c/src/url.c | 186 -- proton-c/src/util.c | 274 -- proton-c/src/util.h | 126 - proton-c/src/windows/io.c | 457 --- proton-c/src/windows/iocp.c | 1176 ------- proton-c/src/windows/iocp.h | 144 - proton-c/src/windows/schannel.c | 2239 ------------- proton-c/src/windows/selector.c | 382 --- proton-c/src/windows/write_pipeline.c | 312 -- tools/cmake/Modules/WindowsC99SymbolCheck.py | 2 +- 145 files changed, 21103 insertions(+), 21029 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a5850716/proton-c/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt index cba043a..3cf01cd 100644 --- a/proton-c/CMakeLists.txt +++ b/proton-c/CMakeLists.txt @@ -81,8 +81,8 @@ set (env_py ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/env.py) add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/src/encodings.h - COMMAND ${env_py} PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/src/codec/encodings.h.py > ${CMAKE_CURRENT_BINARY_DIR}/src/encodings.h - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/codec/encodings.h.py + COMMAND ${env_py} PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/src/encodings.h.py > ${CMAKE_CURRENT_BINARY_DIR}/src/encodings.h + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/encodings.h.py ) add_custom_command ( @@ -93,11 +93,11 @@ add_custom_command ( # Select IO impl if(PN_WINAPI) - set (pn_io_impl src/windows/io.c src/windows/iocp.c src/windows/write_pipeline.c) - set (pn_selector_impl src/windows/selector.c) + set (pn_io_impl src/reactor/io/windows/io.c src/reactor/io/windows/iocp.c src/reactor/io/windows/write_pipeline.c) + set (pn_selector_impl src/reactor/io/windows/selector.c) else(PN_WINAPI) - set (pn_io_impl src/posix/io.c) - set (pn_selector_impl src/posix/selector.c) + set (pn_io_impl src/reactor/io/posix/io.c) + set (pn_selector_impl src/reactor/io/posix/selector.c) endif(PN_WINAPI) # Link in SASL if present @@ -124,7 +124,7 @@ if (SSL_IMPL STREQUAL openssl) include_directories (${OPENSSL_INCLUDE_DIR}) set (SSL_LIB ${OPENSSL_LIBRARIES}) elseif (SSL_IMPL STREQUAL schannel) - set (pn_ssl_impl src/windows/schannel.c) + set (pn_ssl_impl src/ssl/schannel.c) set (SSL_LIB Crypt32.lib Secur32.lib) else () set (pn_ssl_impl src/ssl/ssl_stub.c) @@ -281,6 +281,7 @@ if (MSVC) /wd4800 /wd4996 ) + set (qpid-proton-platform src/compiler/msvc/snprintf.c) endif (MSVC) macro (pn_absolute_install_dir NAME VALUE PREFIX) @@ -303,49 +304,61 @@ add_subdirectory(bindings) add_subdirectory(docs/api) add_subdirectory(../tests/tools/apps/c ../tests/tools/apps/c) -set (qpid-proton-platform +set (qpid-proton-platform-io + src/platform/platform.c ${pn_io_impl} ${pn_selector_impl} - src/platform.c + ) + +set (qpid-proton-layers ${pn_sasl_impl} ${pn_ssl_impl} ) set (qpid-proton-core - src/object/object.c - src/object/list.c - src/object/map.c - src/object/string.c - src/object/iterator.c - src/object/record.c - - src/log.c - src/util.c - src/url.c - src/error.c - src/buffer.c - src/parser.c - src/scanner.c - src/types.c - - src/framing/framing.c - - src/codec/codec.c - src/codec/decoder.c - src/codec/encoder.c - - src/dispatcher/dispatcher.c - src/engine/connection_engine.c - src/engine/engine.c - src/events/event.c - src/transport/autodetect.c - src/transport/transport.c - src/message/message.c + src/core/object/object.c + src/core/object/list.c + src/core/object/map.c + src/core/object/string.c + src/core/object/iterator.c + src/core/object/record.c + + src/core/log.c + src/core/util.c + src/core/error.c + src/core/buffer.c + src/core/types.c + + src/core/framing.c + + src/core/codec.c + src/core/decoder.c + src/core/encoder.c + + src/core/dispatcher.c + src/core/connection_engine.c + src/core/engine.c + src/core/event.c + src/core/autodetect.c + src/core/transport.c + src/core/message.c + ) + +set (qpid-proton-include-generated + ${CMAKE_CURRENT_BINARY_DIR}/src/encodings.h + ${CMAKE_CURRENT_BINARY_DIR}/src/protocol.h + ) + +set (qpid-proton-extra + src/extra/parser.c + src/extra/scanner.c + src/extra/url.c src/reactor/reactor.c src/reactor/handler.c src/reactor/connection.c src/reactor/acceptor.c + src/reactor/selectable.c src/reactor/timer.c src/handlers/handshaker.c @@ -356,12 +369,6 @@ set (qpid-proton-core src/messenger/subscription.c src/messenger/store.c src/messenger/transform.c - src/selectable.c - ) - -set (qpid-proton-extra-deps - ${CMAKE_CURRENT_BINARY_DIR}/src/encodings.h - ${CMAKE_CURRENT_BINARY_DIR}/src/protocol.h ) set (qpid-proton-include @@ -374,39 +381,42 @@ set (qpid-proton-include include/proton/engine.h include/proton/error.h include/proton/event.h - include/proton/handlers.h include/proton/import_export.h - include/proton/io.h include/proton/link.h include/proton/log.h include/proton/message.h - include/proton/messenger.h include/proton/object.h - include/proton/parser.h - include/proton/reactor.h include/proton/sasl.h - include/proton/scanner.h - include/proton/selectable.h - include/proton/selector.h include/proton/session.h include/proton/ssl.h include/proton/terminus.h include/proton/transport.h include/proton/type_compat.h include/proton/types.h +) + +set (qpid-proton-include-extra + include/proton/handlers.h + include/proton/messenger.h + include/proton/parser.h + include/proton/reactor.h + include/proton/selectable.h include/proton/url.h ) -source_group("API Header Files" FILES ${qpid-proton-include}) +source_group("API Header Files" FILES ${qpid-proton-include} ${qpid-proton-include-extra}) set_source_files_properties ( ${qpid-proton-core} + ${qpid-proton-layers} + ${qpid-proton-extra} PROPERTIES COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_LANGUAGE_FLAGS} ${LTO}" ) set_source_files_properties ( ${qpid-proton-platform} + ${qpid-proton-platform-io} PROPERTIES COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_PLATFORM_FLAGS} ${LTO}" COMPILE_DEFINITIONS "${PLATFORM_DEFINITIONS}" @@ -414,18 +424,47 @@ set_source_files_properties ( if (BUILD_WITH_CXX) set_source_files_properties ( - ${qpid-proton-core} ${qpid-proton-platform} + ${qpid-proton-core} + ${qpid-proton-layers} + ${qpid-proton-extra} + ${qpid-proton-platform} + ${qpid-proton-platform-io} PROPERTIES LANGUAGE CXX ) endif (BUILD_WITH_CXX) add_library ( - qpid-proton SHARED + qpid-proton-core SHARED + ${qpid-proton-core} + ${qpid-proton-layers} + ${qpid-proton-platform} + ${qpid-proton-include} + ${qpid-proton-include-generated} + ) + +target_link_libraries (qpid-proton-core ${UUID_LIB} ${SSL_LIB} ${SASL_LIB} ${TIME_LIB} ${PLATFORM_LIBS}) +set_target_properties ( + qpid-proton-core + PROPERTIES + VERSION "${PN_LIB_SOMAJOR}.${PN_LIB_SOMINOR}" + SOVERSION "${PN_LIB_SOMAJOR}" + LINK_FLAGS "${CATCH_UNDEFINED} ${LTO}" + ) + +add_library( + qpid-proton SHARED + # Proton Core ${qpid-proton-core} + ${qpid-proton-layers} ${qpid-proton-platform} ${qpid-proton-include} - ${qpid-proton-extra-deps} + ${qpid-proton-include-generated} + + # Proton Reactor/Messenger + ${qpid-proton-extra} + ${qpid-proton-platform-io} + ${qpid-proton-include-extra} ) target_link_libraries (qpid-proton ${UUID_LIB} ${SSL_LIB} ${SASL_LIB} ${TIME_LIB} ${PLATFORM_LIBS}) @@ -471,13 +510,24 @@ configure_file( install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libqpid-proton.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/src/libqpid-proton-core.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/libqpid-proton-core.pc @ONLY) +install (FILES + ${CMAKE_CURRENT_BINARY_DIR}/libqpid-proton-core.pc + DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) + if (DEFINED CMAKE_IMPORT_LIBRARY_PREFIX) set(PROTONLIB ${CMAKE_IMPORT_LIBRARY_PREFIX}qpid-proton${CMAKE_IMPORT_LIBRARY_SUFFIX}) set(PROTONLIBDEBUG ${CMAKE_IMPORT_LIBRARY_PREFIX}qpid-proton${CMAKE_DEBUG_POSTFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX}) +set(PROTONCORELIB ${CMAKE_IMPORT_LIBRARY_PREFIX}qpid-proton-core${CMAKE_IMPORT_LIBRARY_SUFFIX}) +set(PROTONCORELIBDEBUG ${CMAKE_IMPORT_LIBRARY_PREFIX}qpid-proton-core${CMAKE_DEBUG_POSTFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX}) else () set(PROTONLIB ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton${CMAKE_SHARED_LIBRARY_SUFFIX}) set(PROTONLIBDEBUG ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}) +set(PROTONCORELIB ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton-core${CMAKE_SHARED_LIBRARY_SUFFIX}) +set(PROTONCORELIBDEBUG ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton-core${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}) endif () include(WriteBasicConfigVersionFile) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a5850716/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 ee9cfde..1a85bd3 100644 --- a/proton-c/bindings/python/proton/reactor.py +++ b/proton-c/bindings/python/proton/reactor.py @@ -138,7 +138,7 @@ class Reactor(Wrapper): def wakeup(self): n = pn_reactor_wakeup(self._impl) - if n: raise IOError(pn_error_text(pn_io_error(pn_reactor_io(self._impl)))) + if n: raise IOError(pn_error_text(pn_reactor_error(self._impl))) def start(self): pn_reactor_start(self._impl) @@ -176,7 +176,7 @@ class Reactor(Wrapper): if aimpl: return Acceptor(aimpl) else: - raise IOError("%s (%s:%s)" % (pn_error_text(pn_io_error(pn_reactor_io(self._impl))), host, port)) + raise IOError("%s (%s:%s)" % pn_error_text(pn_reactor_error(self._impl)), host, port) def connection(self, handler=None): """Deprecated: use connection_to_host() instead http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a5850716/proton-c/bindings/python/setup.py ---------------------------------------------------------------------- diff --git a/proton-c/bindings/python/setup.py b/proton-c/bindings/python/setup.py index 1a74f0f..3606bed 100755 --- a/proton-c/bindings/python/setup.py +++ b/proton-c/bindings/python/setup.py @@ -194,8 +194,7 @@ class Configure(build_ext): # 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')], + subprocess.Popen([sys.executable, os.path.join(proton_src, 'encodings.h.py')], env=proton_envs, stdout=header) # Create a custom, temporary, version.h file mapping the @@ -219,10 +218,9 @@ class Configure(build_ext): # we don't need. sources = [] - for subdir in ['object', 'framing', 'codec', 'dispatcher', - 'engine', 'events', 'transport', - 'message', 'reactor', 'messenger', - 'handlers', 'posix']: + for subdir in ['core', 'core/object', 'compiler', + 'extra', 'message', 'reactor', 'messenger', 'handlers', + 'platform', 'reactor/io/posix']: sources.extend(glob.glob(os.path.join(proton_src, subdir, '*.c'))) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a5850716/proton-c/bindings/ruby/lib/reactor/reactor.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/lib/reactor/reactor.rb b/proton-c/bindings/ruby/lib/reactor/reactor.rb index 1cf4f6c..a0ff7e0 100644 --- a/proton-c/bindings/ruby/lib/reactor/reactor.rb +++ b/proton-c/bindings/ruby/lib/reactor/reactor.rb @@ -128,8 +128,7 @@ module Qpid::Proton::Reactor def wakeup n = Cproton.pn_reactor_wakeup(@impl) unless n.zero? - io = Cproton.pn_reactor_io(@impl) - raise IOError.new(Cproton.pn_io_error(io)) + raise IOError.new(Cproton.pn_reactor_error(@impl)) end end @@ -159,8 +158,7 @@ module Qpid::Proton::Reactor if !aimpl.nil? return Acceptor.new(aimpl) else - io = Cproton.pn_reactor_io(@impl) - io_error = Cproton.pn_io_error(io) + io_error = Cproton.pn_reactor_error(@impl) error_text = Cproton.pn_error_text(io_error) text = "(#{Cproton.pn_error_text(io_error)} (#{host}:#{port}))" raise IOError.new(text) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a5850716/proton-c/include/proton/cproton.i ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/cproton.i b/proton-c/include/proton/cproton.i index 6129037..ffcf830 100644 --- a/proton-c/include/proton/cproton.i +++ b/proton-c/include/proton/cproton.i @@ -1014,8 +1014,6 @@ typedef unsigned long int uintptr_t; %include "proton/messenger.h" -%include "proton/io.h" - %include "proton/selectable.h" %include "proton/ssl.h" http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a5850716/proton-c/include/proton/event.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/event.h b/proton-c/include/proton/event.h index 16d2bda..d10927b 100644 --- a/proton-c/include/proton/event.h +++ b/proton-c/include/proton/event.h @@ -415,11 +415,6 @@ PN_EXTERN const pn_class_t *pn_event_class(pn_event_t *event); PN_EXTERN void *pn_event_context(pn_event_t *event); /** - * Get the root handler the current event was dispatched to. - */ -PN_EXTERN pn_handler_t *pn_event_root(pn_event_t *event); - -/** * Get the connection associated with an event. * * @param[in] event an event object http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a5850716/proton-c/include/proton/handlers.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/handlers.h b/proton-c/include/proton/handlers.h index f61e04c..a8a6f77 100644 --- a/proton-c/include/proton/handlers.h +++ b/proton-c/include/proton/handlers.h @@ -43,9 +43,9 @@ typedef pn_handler_t pn_handshaker_t; typedef pn_handler_t pn_iohandler_t; typedef pn_handler_t pn_flowcontroller_t; -PN_EXTERN pn_handshaker_t *pn_handshaker(void); -PN_EXTERN pn_iohandler_t *pn_iohandler(void); -PN_EXTERN pn_flowcontroller_t *pn_flowcontroller(int window); +PNX_EXTERN pn_handshaker_t *pn_handshaker(void); +PNX_EXTERN pn_iohandler_t *pn_iohandler(void); +PNX_EXTERN pn_flowcontroller_t *pn_flowcontroller(int window); /** @} */ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a5850716/proton-c/include/proton/import_export.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/import_export.h b/proton-c/include/proton/import_export.h index 4534d68..0010126 100644 --- a/proton-c/include/proton/import_export.h +++ b/proton-c/include/proton/import_export.h @@ -46,12 +46,18 @@ // For core proton library symbols - -#ifdef qpid_proton_EXPORTS +#if defined(qpid_proton_core_EXPORTS) || defined(qpid_proton_EXPORTS) # define PN_EXTERN PN_EXPORT #else # define PN_EXTERN PN_IMPORT #endif +// For extra proton symbols +#if defined(qpid_proton_EXPORTS) +# define PNX_EXTERN PN_EXPORT +#else +# define PNX_EXTERN PN_IMPORT +#endif + #endif /* import_export.h */ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a5850716/proton-c/include/proton/io.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/io.h b/proton-c/include/proton/io.h deleted file mode 100644 index 19dfe53..0000000 --- a/proton-c/include/proton/io.h +++ /dev/null @@ -1,114 +0,0 @@ -#ifndef PROTON_IO_H -#define PROTON_IO_H 1 - -/* - * - * 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. - * - */ - -#include <proton/import_export.h> -#include <proton/error.h> -#include <proton/type_compat.h> -#include <stddef.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * A ::pn_socket_t provides an abstract handle to an IO stream. The - * pipe version is uni-directional. The network socket version is - * bi-directional. Both are non-blocking. - * - * pn_socket_t handles from ::pn_pipe() may only be used with - * ::pn_read(), ::pn_write(), ::pn_close() and pn_selector_select(). - * - * pn_socket_t handles from ::pn_listen(), ::pn_accept() and - * ::pn_connect() must perform further IO using Proton functions. - * Mixing Proton io.h functions with native IO functions on the same - * handles will result in undefined behavior. - * - * pn_socket_t handles may only be used with a single pn_io_t during - * their lifetime. - */ -#if defined(_WIN32) && ! defined(__CYGWIN__) -#ifdef _WIN64 -typedef unsigned __int64 pn_socket_t; -#else -typedef unsigned int pn_socket_t; -#endif -#define PN_INVALID_SOCKET (pn_socket_t)(~0) -#else -typedef int pn_socket_t; -#define PN_INVALID_SOCKET (-1) -#endif - -/** - * A ::pn_io_t manages IO for a group of pn_socket_t handles. A - * pn_io_t object may have zero or one pn_selector_t selectors - * associated with it (see ::pn_io_selector()). If one is associated, - * all the pn_socket_t handles managed by a pn_io_t must use that - * pn_selector_t instance. - * - * The pn_io_t interface is single-threaded. All methods are intended - * to be used by one thread at a time, except that multiple threads - * may use: - * - * ::pn_write() - * ::pn_send() - * ::pn_recv() - * ::pn_close() - * ::pn_selector_select() - * - * provided at most one thread is calling ::pn_selector_select() and - * the other threads are operating on separate pn_socket_t handles. - */ -typedef struct pn_io_t pn_io_t; - -/** - * A ::pn_selector_t provides a selection mechanism that allows - * efficient monitoring of a large number of Proton connections and - * listeners. - * - * External (non-Proton) sockets may also be monitored, either solely - * for event notification (read, write, and timer) or event - * notification and use with pn_io_t interfaces. - */ -typedef struct pn_selector_t pn_selector_t; - -PN_EXTERN pn_io_t *pn_io(void); -PN_EXTERN void pn_io_free(pn_io_t *io); -PN_EXTERN pn_error_t *pn_io_error(pn_io_t *io); -PN_EXTERN pn_socket_t pn_connect(pn_io_t *io, const char *host, const char *port); -PN_EXTERN pn_socket_t pn_listen(pn_io_t *io, const char *host, const char *port); -PN_EXTERN pn_socket_t pn_accept(pn_io_t *io, pn_socket_t socket, char *name, size_t size); -PN_EXTERN void pn_close(pn_io_t *io, pn_socket_t socket); -PN_EXTERN ssize_t pn_send(pn_io_t *io, pn_socket_t socket, const void *buf, size_t size); -PN_EXTERN ssize_t pn_recv(pn_io_t *io, pn_socket_t socket, void *buf, size_t size); -PN_EXTERN int pn_pipe(pn_io_t *io, pn_socket_t *dest); -PN_EXTERN ssize_t pn_read(pn_io_t *io, pn_socket_t socket, void *buf, size_t size); -PN_EXTERN ssize_t pn_write(pn_io_t *io, pn_socket_t socket, const void *buf, size_t size); -PN_EXTERN bool pn_wouldblock(pn_io_t *io); -PN_EXTERN pn_selector_t *pn_io_selector(pn_io_t *io); - -#ifdef __cplusplus -} -#endif - -#endif /* io.h */ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a5850716/proton-c/include/proton/messenger.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/messenger.h b/proton-c/include/proton/messenger.h index 6d0f58b..8cba51d 100644 --- a/proton-c/include/proton/messenger.h +++ b/proton-c/include/proton/messenger.h @@ -195,7 +195,7 @@ typedef enum { * * @return pointer to a new ::pn_messenger_t */ -PN_EXTERN pn_messenger_t *pn_messenger(const char *name); +PNX_EXTERN pn_messenger_t *pn_messenger(const char *name); /** * Get the name of a messenger. @@ -203,7 +203,7 @@ PN_EXTERN pn_messenger_t *pn_messenger(const char *name); * @param[in] messenger a messenger object * @return the name of the messenger */ -PN_EXTERN const char *pn_messenger_name(pn_messenger_t *messenger); +PNX_EXTERN const char *pn_messenger_name(pn_messenger_t *messenger); /** * Sets the path that will be used to get the certificate that will be @@ -214,7 +214,7 @@ PN_EXTERN const char *pn_messenger_name(pn_messenger_t *messenger); * @param[in] certificate a path to a certificate file * @return an error code of zero if there is no error */ -PN_EXTERN int pn_messenger_set_certificate(pn_messenger_t *messenger, const char *certificate); +PNX_EXTERN int pn_messenger_set_certificate(pn_messenger_t *messenger, const char *certificate); /** * Get the certificate path. This value may be set by @@ -223,7 +223,7 @@ PN_EXTERN int pn_messenger_set_certificate(pn_messenger_t *messenger, const char * @param[in] messenger the messenger * @return the certificate file path */ -PN_EXTERN const char *pn_messenger_get_certificate(pn_messenger_t *messenger); +PNX_EXTERN const char *pn_messenger_get_certificate(pn_messenger_t *messenger); /** * Set path to the private key that was used to sign the certificate. @@ -233,7 +233,7 @@ PN_EXTERN const char *pn_messenger_get_certificate(pn_messenger_t *messenger); * @param[in] private_key a path to a private key file * @return an error code of zero if there is no error */ -PN_EXTERN int pn_messenger_set_private_key(pn_messenger_t *messenger, const char *private_key); +PNX_EXTERN int pn_messenger_set_private_key(pn_messenger_t *messenger, const char *private_key); /** * Gets the private key file for a messenger. @@ -241,7 +241,7 @@ PN_EXTERN int pn_messenger_set_private_key(pn_messenger_t *messenger, const char * @param[in] messenger a messenger object * @return the messenger's private key file path */ -PN_EXTERN const char *pn_messenger_get_private_key(pn_messenger_t *messenger); +PNX_EXTERN const char *pn_messenger_get_private_key(pn_messenger_t *messenger); /** * Sets the private key password for a messenger. @@ -251,7 +251,7 @@ PN_EXTERN const char *pn_messenger_get_private_key(pn_messenger_t *messenger); * * @return an error code of zero if there is no error */ -PN_EXTERN int pn_messenger_set_password(pn_messenger_t *messenger, const char *password); +PNX_EXTERN int pn_messenger_set_password(pn_messenger_t *messenger, const char *password); /** * Gets the private key file password for a messenger. @@ -259,7 +259,7 @@ PN_EXTERN int pn_messenger_set_password(pn_messenger_t *messenger, const char *p * @param[in] messenger a messenger object * @return password for the private key file */ -PN_EXTERN const char *pn_messenger_get_password(pn_messenger_t *messenger); +PNX_EXTERN const char *pn_messenger_get_password(pn_messenger_t *messenger); /** * Sets the trusted certificates database for a messenger. @@ -272,7 +272,7 @@ PN_EXTERN const char *pn_messenger_get_password(pn_messenger_t *messenger); * * @return an error code of zero if there is no error */ -PN_EXTERN int pn_messenger_set_trusted_certificates(pn_messenger_t *messenger, const char *cert_db); +PNX_EXTERN int pn_messenger_set_trusted_certificates(pn_messenger_t *messenger, const char *cert_db); /** * Gets the trusted certificates database for a messenger. @@ -280,7 +280,7 @@ PN_EXTERN int pn_messenger_set_trusted_certificates(pn_messenger_t *messenger, c * @param[in] messenger a messenger object * @return path to the trusted certificates database */ -PN_EXTERN const char *pn_messenger_get_trusted_certificates(pn_messenger_t *messenger); +PNX_EXTERN const char *pn_messenger_get_trusted_certificates(pn_messenger_t *messenger); /** * Set the default timeout for a messenger. @@ -294,7 +294,7 @@ PN_EXTERN const char *pn_messenger_get_trusted_certificates(pn_messenger_t *mess * @param[in] timeout a new timeout for the messenger, in milliseconds * @return an error code or zero if there is no error */ -PN_EXTERN int pn_messenger_set_timeout(pn_messenger_t *messenger, int timeout); +PNX_EXTERN int pn_messenger_set_timeout(pn_messenger_t *messenger, int timeout); /** * Gets the timeout for a messenger object. @@ -304,7 +304,7 @@ PN_EXTERN int pn_messenger_set_timeout(pn_messenger_t *messenger, int timeout); * @param[in] messenger a messenger object * @return the timeout for the messenger, in milliseconds */ -PN_EXTERN int pn_messenger_get_timeout(pn_messenger_t *messenger); +PNX_EXTERN int pn_messenger_get_timeout(pn_messenger_t *messenger); /** * Check if a messenger is in blocking mode. @@ -312,7 +312,7 @@ PN_EXTERN int pn_messenger_get_timeout(pn_messenger_t *messenger); * @param[in] messenger a messenger object * @return true if blocking has been enabled, false otherwise */ -PN_EXTERN bool pn_messenger_is_blocking(pn_messenger_t *messenger); +PNX_EXTERN bool pn_messenger_is_blocking(pn_messenger_t *messenger); /** * Enable or disable blocking behavior for a messenger during calls to @@ -322,7 +322,7 @@ PN_EXTERN bool pn_messenger_is_blocking(pn_messenger_t *messenger); * @param[in] blocking the value of the blocking flag * @return an error code or zero if there is no error */ -PN_EXTERN int pn_messenger_set_blocking(pn_messenger_t *messenger, bool blocking); +PNX_EXTERN int pn_messenger_set_blocking(pn_messenger_t *messenger, bool blocking); /** * Check if a messenger is in passive mode. @@ -336,7 +336,7 @@ PN_EXTERN int pn_messenger_set_blocking(pn_messenger_t *messenger, bool blocking * @param[in] messenger a messenger object * @return true if the messenger is in passive mode, false otherwise */ -PN_EXTERN bool pn_messenger_is_passive(pn_messenger_t *messenger); +PNX_EXTERN bool pn_messenger_is_passive(pn_messenger_t *messenger); /** * Set the passive mode for a messenger. @@ -348,14 +348,14 @@ PN_EXTERN bool pn_messenger_is_passive(pn_messenger_t *messenger); * passive mode * @return an error code or zero on success */ -PN_EXTERN int pn_messenger_set_passive(pn_messenger_t *messenger, bool passive); +PNX_EXTERN int pn_messenger_set_passive(pn_messenger_t *messenger, bool passive); /** Frees a Messenger. * * @param[in] messenger the messenger to free (or NULL), no longer * valid on return */ -PN_EXTERN void pn_messenger_free(pn_messenger_t *messenger); +PNX_EXTERN void pn_messenger_free(pn_messenger_t *messenger); /** * Get the code for a messenger's most recent error. @@ -370,7 +370,7 @@ PN_EXTERN void pn_messenger_free(pn_messenger_t *messenger); * @return an error code or zero if there is no error * @see error.h */ -PN_EXTERN int pn_messenger_errno(pn_messenger_t *messenger); +PNX_EXTERN int pn_messenger_errno(pn_messenger_t *messenger); /** * Get a messenger's error object. @@ -383,7 +383,7 @@ PN_EXTERN int pn_messenger_errno(pn_messenger_t *messenger); * @return a pointer to the messenger's error descriptor * @see error.h */ -PN_EXTERN pn_error_t *pn_messenger_error(pn_messenger_t *messenger); +PNX_EXTERN pn_error_t *pn_messenger_error(pn_messenger_t *messenger); /** * Get the size of a messenger's outgoing window. @@ -400,7 +400,7 @@ PN_EXTERN pn_error_t *pn_messenger_error(pn_messenger_t *messenger); * @param[in] messenger a messenger object * @return the outgoing window for the messenger */ -PN_EXTERN int pn_messenger_get_outgoing_window(pn_messenger_t *messenger); +PNX_EXTERN int pn_messenger_get_outgoing_window(pn_messenger_t *messenger); /** * Set the size of a messenger's outgoing window. @@ -412,7 +412,7 @@ PN_EXTERN int pn_messenger_get_outgoing_window(pn_messenger_t *messenger); * @return an error or zero on success * @see error.h */ -PN_EXTERN int pn_messenger_set_outgoing_window(pn_messenger_t *messenger, int window); +PNX_EXTERN int pn_messenger_set_outgoing_window(pn_messenger_t *messenger, int window); /** * Get the size of a messenger's incoming window. @@ -432,7 +432,7 @@ PN_EXTERN int pn_messenger_set_outgoing_window(pn_messenger_t *messenger, int wi * @param[in] messenger a messenger object * @return the incoming window for the messenger */ -PN_EXTERN int pn_messenger_get_incoming_window(pn_messenger_t *messenger); +PNX_EXTERN int pn_messenger_get_incoming_window(pn_messenger_t *messenger); /** * Set the size of a messenger's incoming window. @@ -444,7 +444,7 @@ PN_EXTERN int pn_messenger_get_incoming_window(pn_messenger_t *messenger); * @return an error or zero on success * @see error.h */ -PN_EXTERN int pn_messenger_set_incoming_window(pn_messenger_t *messenger, +PNX_EXTERN int pn_messenger_set_incoming_window(pn_messenger_t *messenger, int window); /** @@ -455,7 +455,7 @@ PN_EXTERN int pn_messenger_set_incoming_window(pn_messenger_t *messenger, * @return an error code or zero on success * @see error.h */ -PN_EXTERN int pn_messenger_start(pn_messenger_t *messenger); +PNX_EXTERN int pn_messenger_start(pn_messenger_t *messenger); /** * Stops a messenger. @@ -471,7 +471,7 @@ PN_EXTERN int pn_messenger_start(pn_messenger_t *messenger); * @return an error code or zero on success * @see error.h */ -PN_EXTERN int pn_messenger_stop(pn_messenger_t *messenger); +PNX_EXTERN int pn_messenger_stop(pn_messenger_t *messenger); /** * Returns true if a messenger is in the stopped state. This function @@ -480,7 +480,7 @@ PN_EXTERN int pn_messenger_stop(pn_messenger_t *messenger); * @param[in] messenger the messenger to stop * */ -PN_EXTERN bool pn_messenger_stopped(pn_messenger_t *messenger); +PNX_EXTERN bool pn_messenger_stopped(pn_messenger_t *messenger); /** * Subscribes a messenger to messages from the specified source. @@ -489,7 +489,7 @@ PN_EXTERN bool pn_messenger_stopped(pn_messenger_t *messenger); * @param[in] source * @return a subscription */ -PN_EXTERN pn_subscription_t *pn_messenger_subscribe(pn_messenger_t *messenger, const char *source); +PNX_EXTERN pn_subscription_t *pn_messenger_subscribe(pn_messenger_t *messenger, const char *source); /** * Subscribes a messenger to messages from the specified source with the given @@ -501,7 +501,7 @@ PN_EXTERN pn_subscription_t *pn_messenger_subscribe(pn_messenger_t *messenger, c * link is closed. * @return a subscription */ -PN_EXTERN pn_subscription_t * +PNX_EXTERN pn_subscription_t * pn_messenger_subscribe_ttl(pn_messenger_t *messenger, const char *source, pn_seconds_t timeout); @@ -514,7 +514,7 @@ pn_messenger_subscribe_ttl(pn_messenger_t *messenger, const char *source, * receiver * @return a link, or NULL if no link matches the address / sender parameters */ -PN_EXTERN pn_link_t *pn_messenger_get_link(pn_messenger_t *messenger, +PNX_EXTERN pn_link_t *pn_messenger_get_link(pn_messenger_t *messenger, const char *address, bool sender); /** @@ -525,7 +525,7 @@ PN_EXTERN pn_link_t *pn_messenger_get_link(pn_messenger_t *messenger, * @param[in] sub a subscription object * @return the subscription's application context */ -PN_EXTERN void *pn_subscription_get_context(pn_subscription_t *sub); +PNX_EXTERN void *pn_subscription_get_context(pn_subscription_t *sub); /** * Set an application context for a subscription. @@ -533,7 +533,7 @@ PN_EXTERN void *pn_subscription_get_context(pn_subscription_t *sub); * @param[in] sub a subscription object * @param[in] context the application context for the subscription */ -PN_EXTERN void pn_subscription_set_context(pn_subscription_t *sub, void *context); +PNX_EXTERN void pn_subscription_set_context(pn_subscription_t *sub, void *context); /** * Get the source address of a subscription. @@ -541,7 +541,7 @@ PN_EXTERN void pn_subscription_set_context(pn_subscription_t *sub, void *context * @param[in] sub a subscription object * @return the subscription's source address */ -PN_EXTERN const char *pn_subscription_address(pn_subscription_t *sub); +PNX_EXTERN const char *pn_subscription_address(pn_subscription_t *sub); /** * Puts a message onto the messenger's outgoing queue. The message may @@ -553,7 +553,7 @@ PN_EXTERN const char *pn_subscription_address(pn_subscription_t *sub); * @return an error code or zero on success * @see error.h */ -PN_EXTERN int pn_messenger_put(pn_messenger_t *messenger, pn_message_t *msg); +PNX_EXTERN int pn_messenger_put(pn_messenger_t *messenger, pn_message_t *msg); /** * Track the status of a delivery. @@ -566,7 +566,7 @@ PN_EXTERN int pn_messenger_put(pn_messenger_t *messenger, pn_message_t *msg); * @param[in] tracker the tracker identifying the delivery * @return a status code for the delivery */ -PN_EXTERN pn_status_t pn_messenger_status(pn_messenger_t *messenger, pn_tracker_t tracker); +PNX_EXTERN pn_status_t pn_messenger_status(pn_messenger_t *messenger, pn_tracker_t tracker); /** * Get delivery information about a delivery. @@ -579,7 +579,7 @@ PN_EXTERN pn_status_t pn_messenger_status(pn_messenger_t *messenger, pn_tracker_ * @param[in] tracker the tracker identifying the delivery * @return a pn_delivery_t representing the delivery. */ -PN_EXTERN pn_delivery_t *pn_messenger_delivery(pn_messenger_t *messenger, +PNX_EXTERN pn_delivery_t *pn_messenger_delivery(pn_messenger_t *messenger, pn_tracker_t tracker); /** @@ -594,7 +594,7 @@ PN_EXTERN pn_delivery_t *pn_messenger_delivery(pn_messenger_t *messenger, * * @return true if the delivery is still buffered */ -PN_EXTERN bool pn_messenger_buffered(pn_messenger_t *messenger, pn_tracker_t tracker); +PNX_EXTERN bool pn_messenger_buffered(pn_messenger_t *messenger, pn_tracker_t tracker); /** * Frees a Messenger from tracking the status associated with a given @@ -608,7 +608,7 @@ PN_EXTERN bool pn_messenger_buffered(pn_messenger_t *messenger, pn_tracker_t tra * @return an error code or zero on success * @see error.h */ -PN_EXTERN int pn_messenger_settle(pn_messenger_t *messenger, pn_tracker_t tracker, int flags); +PNX_EXTERN int pn_messenger_settle(pn_messenger_t *messenger, pn_tracker_t tracker, int flags); /** * Get a tracker for the outgoing message most recently given to @@ -623,7 +623,7 @@ PN_EXTERN int pn_messenger_settle(pn_messenger_t *messenger, pn_tracker_t tracke * @return a pn_tracker_t or an undefined value if pn_messenger_get * has never been called for the given messenger */ -PN_EXTERN pn_tracker_t pn_messenger_outgoing_tracker(pn_messenger_t *messenger); +PNX_EXTERN pn_tracker_t pn_messenger_outgoing_tracker(pn_messenger_t *messenger); /** * Sends or receives any outstanding messages queued for a messenger. @@ -635,7 +635,7 @@ PN_EXTERN pn_tracker_t pn_messenger_outgoing_tracker(pn_messenger_t *messenger); * * @return 0 if no work to do, < 0 if error, or 1 if work was done. */ -PN_EXTERN int pn_messenger_work(pn_messenger_t *messenger, int timeout); +PNX_EXTERN int pn_messenger_work(pn_messenger_t *messenger, int timeout); /** * Interrupt a messenger object that may be blocking in another @@ -648,7 +648,7 @@ PN_EXTERN int pn_messenger_work(pn_messenger_t *messenger, int timeout); * * @param[in] messenger the Messenger to interrupt */ -PN_EXTERN int pn_messenger_interrupt(pn_messenger_t *messenger); +PNX_EXTERN int pn_messenger_interrupt(pn_messenger_t *messenger); /** * Send messages from a messenger's outgoing queue. @@ -682,7 +682,7 @@ PN_EXTERN int pn_messenger_interrupt(pn_messenger_t *messenger); * @return an error code or zero on success * @see error.h */ -PN_EXTERN int pn_messenger_send(pn_messenger_t *messenger, int n); +PNX_EXTERN int pn_messenger_send(pn_messenger_t *messenger, int n); /** * Retrieve messages into a messenger's incoming queue. @@ -708,7 +708,7 @@ PN_EXTERN int pn_messenger_send(pn_messenger_t *messenger, int n); * @return an error code or zero on success * @see error.h */ -PN_EXTERN int pn_messenger_recv(pn_messenger_t *messenger, int limit); +PNX_EXTERN int pn_messenger_recv(pn_messenger_t *messenger, int limit); /** * Get the capacity of the incoming message queue of a messenger. @@ -720,7 +720,7 @@ PN_EXTERN int pn_messenger_recv(pn_messenger_t *messenger, int limit); * * @param[in] messenger the messenger */ -PN_EXTERN int pn_messenger_receiving(pn_messenger_t *messenger); +PNX_EXTERN int pn_messenger_receiving(pn_messenger_t *messenger); /** * Get the next message from the head of a messenger's incoming queue. @@ -736,7 +736,7 @@ PN_EXTERN int pn_messenger_receiving(pn_messenger_t *messenger); * @return an error code or zero on success * @see error.h */ -PN_EXTERN int pn_messenger_get(pn_messenger_t *messenger, pn_message_t *message); +PNX_EXTERN int pn_messenger_get(pn_messenger_t *messenger, pn_message_t *message); /** * Get a tracker for the message most recently retrieved by @@ -751,7 +751,7 @@ PN_EXTERN int pn_messenger_get(pn_messenger_t *messenger, pn_message_t *message) * @return a pn_tracker_t or an undefined value if pn_messenger_get * has never been called for the given messenger */ -PN_EXTERN pn_tracker_t pn_messenger_incoming_tracker(pn_messenger_t *messenger); +PNX_EXTERN pn_tracker_t pn_messenger_incoming_tracker(pn_messenger_t *messenger); /** * Get the subscription of the message most recently retrieved by ::pn_messenger_get(). @@ -762,7 +762,7 @@ PN_EXTERN pn_tracker_t pn_messenger_incoming_tracker(pn_messenger_t *messenger); * @param[in] messenger a messenger object * @return a pn_subscription_t or NULL */ -PN_EXTERN pn_subscription_t *pn_messenger_incoming_subscription(pn_messenger_t *messenger); +PNX_EXTERN pn_subscription_t *pn_messenger_incoming_subscription(pn_messenger_t *messenger); /** * Indicates that an accept or reject should operate cumulatively. @@ -790,7 +790,7 @@ PN_EXTERN pn_subscription_t *pn_messenger_incoming_subscription(pn_messenger_t * * @return an error code or zero on success * @see error.h */ -PN_EXTERN int pn_messenger_accept(pn_messenger_t *messenger, pn_tracker_t tracker, int flags); +PNX_EXTERN int pn_messenger_accept(pn_messenger_t *messenger, pn_tracker_t tracker, int flags); /** * Signal unsuccessful processing of message(s). @@ -813,7 +813,7 @@ PN_EXTERN int pn_messenger_accept(pn_messenger_t *messenger, pn_tracker_t tracke * @return an error code or zero on success * @see error.h */ -PN_EXTERN int pn_messenger_reject(pn_messenger_t *messenger, pn_tracker_t tracker, int flags); +PNX_EXTERN int pn_messenger_reject(pn_messenger_t *messenger, pn_tracker_t tracker, int flags); /** * Get link for the message referenced by the given tracker. @@ -822,7 +822,7 @@ PN_EXTERN int pn_messenger_reject(pn_messenger_t *messenger, pn_tracker_t tracke * @param[in] tracker a tracker object * @return a pn_link_t or NULL if the link could not be determined. */ -PN_EXTERN pn_link_t *pn_messenger_tracker_link(pn_messenger_t *messenger, +PNX_EXTERN pn_link_t *pn_messenger_tracker_link(pn_messenger_t *messenger, pn_tracker_t tracker); /** @@ -832,7 +832,7 @@ PN_EXTERN pn_link_t *pn_messenger_tracker_link(pn_messenger_t *messenger, * @param[in] messenger a messenger object * @return the outgoing queue depth */ -PN_EXTERN int pn_messenger_outgoing(pn_messenger_t *messenger); +PNX_EXTERN int pn_messenger_outgoing(pn_messenger_t *messenger); /** * Get the number of messages in the incoming message queue of a messenger. @@ -840,7 +840,7 @@ PN_EXTERN int pn_messenger_outgoing(pn_messenger_t *messenger); * @param[in] messenger a messenger object * @return the incoming queue depth */ -PN_EXTERN int pn_messenger_incoming(pn_messenger_t *messenger); +PNX_EXTERN int pn_messenger_incoming(pn_messenger_t *messenger); //! Adds a routing rule to a Messenger's internal routing table. //! @@ -904,7 +904,7 @@ PN_EXTERN int pn_messenger_incoming(pn_messenger_t *messenger); //! //! @return an error code or zero on success //! @see error.h -PN_EXTERN int pn_messenger_route(pn_messenger_t *messenger, const char *pattern, +PNX_EXTERN int pn_messenger_route(pn_messenger_t *messenger, const char *pattern, const char *address); /** @@ -929,7 +929,7 @@ PN_EXTERN int pn_messenger_route(pn_messenger_t *messenger, const char *pattern, * @param[in] address an address indicating outgoing address rewrite * @return an error code or zero on success */ -PN_EXTERN int pn_messenger_rewrite(pn_messenger_t *messenger, const char *pattern, +PNX_EXTERN int pn_messenger_rewrite(pn_messenger_t *messenger, const char *pattern, const char *address); /** @@ -960,7 +960,7 @@ PN_EXTERN int pn_messenger_rewrite(pn_messenger_t *messenger, const char *patter * @param[in] messenger a messenger object * @return the next selectable, or NULL if there are none left */ -PN_EXTERN pn_selectable_t *pn_messenger_selectable(pn_messenger_t *messenger); +PNX_EXTERN pn_selectable_t *pn_messenger_selectable(pn_messenger_t *messenger); /** * Get the nearest deadline for selectables associated with a messenger. @@ -968,7 +968,7 @@ PN_EXTERN pn_selectable_t *pn_messenger_selectable(pn_messenger_t *messenger); * @param[in] messenger a messenger object * @return the nearest deadline */ -PN_EXTERN pn_timestamp_t pn_messenger_deadline(pn_messenger_t *messenger); +PNX_EXTERN pn_timestamp_t pn_messenger_deadline(pn_messenger_t *messenger); /** * @} @@ -991,7 +991,7 @@ PN_EXTERN pn_timestamp_t pn_messenger_deadline(pn_messenger_t *messenger); * * @return an error code of zero if there is no error */ -PN_EXTERN int pn_messenger_set_flags(pn_messenger_t *messenger, +PNX_EXTERN int pn_messenger_set_flags(pn_messenger_t *messenger, const int flags); /** Gets the flags for a Messenger. @@ -999,7 +999,7 @@ PN_EXTERN int pn_messenger_set_flags(pn_messenger_t *messenger, * @param[in] messenger the messenger * @return The flags set for the messenger */ -PN_EXTERN int pn_messenger_get_flags(pn_messenger_t *messenger); +PNX_EXTERN int pn_messenger_get_flags(pn_messenger_t *messenger); /** * Set the local sender settle mode for the underlying link. @@ -1007,7 +1007,7 @@ PN_EXTERN int pn_messenger_get_flags(pn_messenger_t *messenger); * @param[in] messenger the messenger * @param[in] mode the sender settle mode */ -PN_EXTERN int pn_messenger_set_snd_settle_mode(pn_messenger_t *messenger, +PNX_EXTERN int pn_messenger_set_snd_settle_mode(pn_messenger_t *messenger, const pn_snd_settle_mode_t mode); /** @@ -1016,7 +1016,7 @@ PN_EXTERN int pn_messenger_set_snd_settle_mode(pn_messenger_t *messenger, * @param[in] messenger the messenger * @param[in] mode the receiver settle mode */ -PN_EXTERN int pn_messenger_set_rcv_settle_mode(pn_messenger_t *messenger, +PNX_EXTERN int pn_messenger_set_rcv_settle_mode(pn_messenger_t *messenger, const pn_rcv_settle_mode_t mode); /** @@ -1025,7 +1025,7 @@ PN_EXTERN int pn_messenger_set_rcv_settle_mode(pn_messenger_t *messenger, * @param[in] messenger a messenger object * @param[in] tracer the tracer callback */ -PN_EXTERN void pn_messenger_set_tracer(pn_messenger_t *messenger, +PNX_EXTERN void pn_messenger_set_tracer(pn_messenger_t *messenger, pn_tracer_t tracer); /** @@ -1035,7 +1035,7 @@ PN_EXTERN void pn_messenger_set_tracer(pn_messenger_t *messenger, * @param[in] address of remote service whose idle timeout is required * @return the timeout in milliseconds or -1 if an error occurs */ -PN_EXTERN pn_millis_t +PNX_EXTERN pn_millis_t pn_messenger_get_remote_idle_timeout(pn_messenger_t *messenger, const char *address); @@ -1048,7 +1048,7 @@ PN_EXTERN pn_millis_t * enum for valid values) * @return 0 if successful or -1 if an error occurs */ -PN_EXTERN int +PNX_EXTERN int pn_messenger_set_ssl_peer_authentication_mode(pn_messenger_t *messenger, const pn_ssl_verify_mode_t mode); http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a5850716/proton-c/include/proton/reactor.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/reactor.h b/proton-c/include/proton/reactor.h index 78fe57b..bfd6de5 100644 --- a/proton-c/include/proton/reactor.h +++ b/proton-c/include/proton/reactor.h @@ -1,3 +1,4 @@ + #ifndef PROTON_REACTOR_H #define PROTON_REACTOR_H 1 @@ -24,6 +25,7 @@ #include <proton/import_export.h> #include <proton/type_compat.h> +#include <proton/error.h> #include <proton/event.h> #include <proton/selectable.h> #include <proton/ssl.h> @@ -46,35 +48,34 @@ typedef struct pn_acceptor_t pn_acceptor_t; typedef struct pn_timer_t pn_timer_t; typedef struct pn_task_t pn_task_t; -PN_EXTERN pn_handler_t *pn_handler(void (*dispatch)(pn_handler_t *, pn_event_t *, pn_event_type_t)); -PN_EXTERN pn_handler_t *pn_handler_new(void (*dispatch)(pn_handler_t *, pn_event_t *, pn_event_type_t), size_t size, +PNX_EXTERN pn_handler_t *pn_handler(void (*dispatch)(pn_handler_t *, pn_event_t *, pn_event_type_t)); +PNX_EXTERN pn_handler_t *pn_handler_new(void (*dispatch)(pn_handler_t *, pn_event_t *, pn_event_type_t), size_t size, void (*finalize)(pn_handler_t *)); -PN_EXTERN void pn_handler_free(pn_handler_t *handler); -PN_EXTERN void *pn_handler_mem(pn_handler_t *handler); -PN_EXTERN void pn_handler_add(pn_handler_t *handler, pn_handler_t *child); -PN_EXTERN void pn_handler_clear(pn_handler_t *handler); -PN_EXTERN void pn_handler_dispatch(pn_handler_t *handler, pn_event_t *event, pn_event_type_t type); - -PN_EXTERN pn_reactor_t *pn_reactor(void); -PN_EXTERN pn_record_t *pn_reactor_attachments(pn_reactor_t *reactor); -PN_EXTERN pn_millis_t pn_reactor_get_timeout(pn_reactor_t *reactor); -PN_EXTERN void pn_reactor_set_timeout(pn_reactor_t *reactor, pn_millis_t timeout); -PN_EXTERN pn_timestamp_t pn_reactor_mark(pn_reactor_t *reactor); -PN_EXTERN pn_timestamp_t pn_reactor_now(pn_reactor_t *reactor); -PN_EXTERN void pn_reactor_yield(pn_reactor_t *reactor); -PN_EXTERN void pn_reactor_free(pn_reactor_t *reactor); -PN_EXTERN pn_collector_t *pn_reactor_collector(pn_reactor_t *reactor); -PN_EXTERN pn_handler_t *pn_reactor_get_global_handler(pn_reactor_t *reactor); -PN_EXTERN void pn_reactor_set_global_handler(pn_reactor_t *reactor, pn_handler_t *handler); -PN_EXTERN pn_handler_t *pn_reactor_get_handler(pn_reactor_t *reactor); -PN_EXTERN void pn_reactor_set_handler(pn_reactor_t *reactor, pn_handler_t *handler); -PN_EXTERN pn_io_t *pn_reactor_io(pn_reactor_t *reactor); -PN_EXTERN pn_list_t *pn_reactor_children(pn_reactor_t *reactor); -PN_EXTERN pn_selectable_t *pn_reactor_selectable(pn_reactor_t *reactor); -PN_EXTERN void pn_reactor_update(pn_reactor_t *reactor, pn_selectable_t *selectable); -PN_EXTERN pn_acceptor_t *pn_reactor_acceptor(pn_reactor_t *reactor, const char *host, const char *port, +PNX_EXTERN void pn_handler_free(pn_handler_t *handler); +PNX_EXTERN void *pn_handler_mem(pn_handler_t *handler); +PNX_EXTERN void pn_handler_add(pn_handler_t *handler, pn_handler_t *child); +PNX_EXTERN void pn_handler_clear(pn_handler_t *handler); +PNX_EXTERN void pn_handler_dispatch(pn_handler_t *handler, pn_event_t *event, pn_event_type_t type); + +PNX_EXTERN pn_reactor_t *pn_reactor(void); +PNX_EXTERN pn_record_t *pn_reactor_attachments(pn_reactor_t *reactor); +PNX_EXTERN pn_millis_t pn_reactor_get_timeout(pn_reactor_t *reactor); +PNX_EXTERN void pn_reactor_set_timeout(pn_reactor_t *reactor, pn_millis_t timeout); +PNX_EXTERN pn_timestamp_t pn_reactor_mark(pn_reactor_t *reactor); +PNX_EXTERN pn_timestamp_t pn_reactor_now(pn_reactor_t *reactor); +PNX_EXTERN void pn_reactor_yield(pn_reactor_t *reactor); +PNX_EXTERN void pn_reactor_free(pn_reactor_t *reactor); +PNX_EXTERN pn_collector_t *pn_reactor_collector(pn_reactor_t *reactor); +PNX_EXTERN pn_handler_t *pn_reactor_get_global_handler(pn_reactor_t *reactor); +PNX_EXTERN void pn_reactor_set_global_handler(pn_reactor_t *reactor, pn_handler_t *handler); +PNX_EXTERN pn_handler_t *pn_reactor_get_handler(pn_reactor_t *reactor); +PNX_EXTERN void pn_reactor_set_handler(pn_reactor_t *reactor, pn_handler_t *handler); +PNX_EXTERN pn_list_t *pn_reactor_children(pn_reactor_t *reactor); +PNX_EXTERN pn_selectable_t *pn_reactor_selectable(pn_reactor_t *reactor); +PNX_EXTERN void pn_reactor_update(pn_reactor_t *reactor, pn_selectable_t *selectable); +PNX_EXTERN pn_acceptor_t *pn_reactor_acceptor(pn_reactor_t *reactor, const char *host, const char *port, pn_handler_t *handler); -PN_EXTERN pn_error_t *pn_reactor_error(pn_reactor_t *reactor); +PNX_EXTERN pn_error_t *pn_reactor_error(pn_reactor_t *reactor); /** * Create an outgoing connection that will be managed by the reactor. @@ -89,7 +90,7 @@ PN_EXTERN pn_error_t *pn_reactor_error(pn_reactor_t *reactor); * this connection. * @return a connection object */ -PN_EXTERN pn_connection_t *pn_reactor_connection_to_host(pn_reactor_t *reactor, +PNX_EXTERN pn_connection_t *pn_reactor_connection_to_host(pn_reactor_t *reactor, const char *host, const char *port, pn_handler_t *handler); @@ -108,7 +109,7 @@ PN_EXTERN pn_connection_t *pn_reactor_connection_to_host(pn_reactor_t *reactor, * @return a connection object * @deprecated Use ::pn_reactor_connection_to_host() instead. */ -PN_EXTERN pn_connection_t *pn_reactor_connection(pn_reactor_t *reactor, +PNX_EXTERN pn_connection_t *pn_reactor_connection(pn_reactor_t *reactor, pn_handler_t *handler); /** @@ -122,7 +123,7 @@ PN_EXTERN pn_connection_t *pn_reactor_connection(pn_reactor_t *reactor, * @param[in] host the network address or DNS name of the host to connect to. * @param[in] port the network port to use. Optional - default is "5672" */ -PN_EXTERN void pn_reactor_set_connection_host(pn_reactor_t *reactor, +PNX_EXTERN void pn_reactor_set_connection_host(pn_reactor_t *reactor, pn_connection_t *connection, const char *host, const char *port); @@ -145,37 +146,42 @@ PN_EXTERN void pn_reactor_set_connection_host(pn_reactor_t *reactor, * address available. ::pn_url_parse() may be used to create a Proton pn_url_t * instance from the returned value. */ -PN_EXTERN const char *pn_reactor_get_connection_address(pn_reactor_t *reactor, +PNX_EXTERN const char *pn_reactor_get_connection_address(pn_reactor_t *reactor, pn_connection_t *connection); -PN_EXTERN int pn_reactor_wakeup(pn_reactor_t *reactor); -PN_EXTERN void pn_reactor_start(pn_reactor_t *reactor); -PN_EXTERN bool pn_reactor_quiesced(pn_reactor_t *reactor); -PN_EXTERN bool pn_reactor_process(pn_reactor_t *reactor); -PN_EXTERN void pn_reactor_stop(pn_reactor_t *reactor); -PN_EXTERN void pn_reactor_run(pn_reactor_t *reactor); -PN_EXTERN pn_task_t *pn_reactor_schedule(pn_reactor_t *reactor, int delay, pn_handler_t *handler); +PNX_EXTERN int pn_reactor_wakeup(pn_reactor_t *reactor); +PNX_EXTERN void pn_reactor_start(pn_reactor_t *reactor); +PNX_EXTERN bool pn_reactor_quiesced(pn_reactor_t *reactor); +PNX_EXTERN bool pn_reactor_process(pn_reactor_t *reactor); +PNX_EXTERN void pn_reactor_stop(pn_reactor_t *reactor); +PNX_EXTERN void pn_reactor_run(pn_reactor_t *reactor); +PNX_EXTERN pn_task_t *pn_reactor_schedule(pn_reactor_t *reactor, int delay, pn_handler_t *handler); + +PNX_EXTERN void pn_acceptor_set_ssl_domain(pn_acceptor_t *acceptor, pn_ssl_domain_t *domain); +PNX_EXTERN void pn_acceptor_close(pn_acceptor_t *acceptor); +PNX_EXTERN pn_acceptor_t *pn_connection_acceptor(pn_connection_t *connection); -PN_EXTERN void pn_acceptor_set_ssl_domain(pn_acceptor_t *acceptor, pn_ssl_domain_t *domain); -PN_EXTERN void pn_acceptor_close(pn_acceptor_t *acceptor); -PN_EXTERN pn_acceptor_t *pn_connection_acceptor(pn_connection_t *connection); +PNX_EXTERN pn_timer_t *pn_timer(pn_collector_t *collector); +PNX_EXTERN pn_timestamp_t pn_timer_deadline(pn_timer_t *timer); +PNX_EXTERN void pn_timer_tick(pn_timer_t *timer, pn_timestamp_t now); +PNX_EXTERN pn_task_t *pn_timer_schedule(pn_timer_t *timer, pn_timestamp_t deadline); +PNX_EXTERN int pn_timer_tasks(pn_timer_t *timer); -PN_EXTERN pn_timer_t *pn_timer(pn_collector_t *collector); -PN_EXTERN pn_timestamp_t pn_timer_deadline(pn_timer_t *timer); -PN_EXTERN void pn_timer_tick(pn_timer_t *timer, pn_timestamp_t now); -PN_EXTERN pn_task_t *pn_timer_schedule(pn_timer_t *timer, pn_timestamp_t deadline); -PN_EXTERN int pn_timer_tasks(pn_timer_t *timer); +PNX_EXTERN pn_record_t *pn_task_attachments(pn_task_t *task); +PNX_EXTERN void pn_task_cancel(pn_task_t *task); -PN_EXTERN pn_record_t *pn_task_attachments(pn_task_t *task); -PN_EXTERN void pn_task_cancel(pn_task_t *task); +PNX_EXTERN pn_reactor_t *pn_class_reactor(const pn_class_t *clazz, void *object); +PNX_EXTERN pn_reactor_t *pn_object_reactor(void *object); +PNX_EXTERN pn_reactor_t *pn_event_reactor(pn_event_t *event); -PN_EXTERN pn_reactor_t *pn_class_reactor(const pn_class_t *clazz, void *object); -PN_EXTERN pn_reactor_t *pn_object_reactor(void *object); -PN_EXTERN pn_reactor_t *pn_event_reactor(pn_event_t *event); +PNX_EXTERN pn_handler_t *pn_record_get_handler(pn_record_t *record); +PNX_EXTERN void pn_record_set_handler(pn_record_t *record, pn_handler_t *handler); -PN_EXTERN pn_handler_t *pn_record_get_handler(pn_record_t *record); -PN_EXTERN void pn_record_set_handler(pn_record_t *record, pn_handler_t *handler); +/** + * Get the root handler the current event was dispatched to. + */ +PNX_EXTERN pn_handler_t *pn_event_root(pn_event_t *event); /** @} */ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a5850716/proton-c/include/proton/scanner.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/scanner.h b/proton-c/include/proton/scanner.h deleted file mode 100644 index 10d7d32..0000000 --- a/proton-c/include/proton/scanner.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef PROTON_SCANNER_H -#define PROTON_SCANNER_H 1 - -/* - * - * 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. - * - */ - -#include <proton/import_export.h> -#include <stddef.h> -#include <stdarg.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - PN_TOK_LBRACE, - PN_TOK_RBRACE, - PN_TOK_LBRACKET, - PN_TOK_RBRACKET, - PN_TOK_EQUAL, - PN_TOK_COMMA, - PN_TOK_POS, - PN_TOK_NEG, - PN_TOK_DOT, - PN_TOK_AT, - PN_TOK_DOLLAR, - PN_TOK_BINARY, - PN_TOK_STRING, - PN_TOK_SYMBOL, - PN_TOK_ID, - PN_TOK_FLOAT, - PN_TOK_INT, - PN_TOK_TRUE, - PN_TOK_FALSE, - PN_TOK_NULL, - PN_TOK_EOS, - PN_TOK_ERR -} pn_token_type_t; - -typedef struct pn_scanner_t pn_scanner_t; - -typedef struct { - pn_token_type_t type; - const char *start; - size_t size; -} pn_token_t; - -PN_EXTERN pn_scanner_t *pn_scanner(void); -PN_EXTERN void pn_scanner_free(pn_scanner_t *scanner); -PN_EXTERN pn_token_t pn_scanner_token(pn_scanner_t *scanner); -PN_EXTERN int pn_scanner_err(pn_scanner_t *scanner, int code, const char *fmt, ...); -PN_EXTERN int pn_scanner_verr(pn_scanner_t *scanner, int code, const char *fmt, va_list ap); -PN_EXTERN void pn_scanner_line_info(pn_scanner_t *scanner, int *line, int *col); -PN_EXTERN int pn_scanner_errno(pn_scanner_t *scanner); -PN_EXTERN const char *pn_scanner_error(pn_scanner_t *scanner); -PN_EXTERN int pn_scanner_start(pn_scanner_t *scanner, const char *input); -PN_EXTERN int pn_scanner_scan(pn_scanner_t *scanner); -PN_EXTERN int pn_scanner_shift(pn_scanner_t *scanner); - -#ifdef __cplusplus -} -#endif - -#endif /* scanner.h */ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a5850716/proton-c/include/proton/selectable.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/selectable.h b/proton-c/include/proton/selectable.h index 7b0fa02..fbf3823 100644 --- a/proton-c/include/proton/selectable.h +++ b/proton-c/include/proton/selectable.h @@ -25,7 +25,6 @@ #include <proton/import_export.h> #include <proton/object.h> #include <proton/event.h> -#include <proton/io.h> #include <proton/type_compat.h> #ifdef __cplusplus @@ -48,6 +47,34 @@ extern "C" { typedef pn_iterator_t pn_selectables_t; /** + * A ::pn_socket_t provides an abstract handle to an IO stream. The + * pipe version is uni-directional. The network socket version is + * bi-directional. Both are non-blocking. + * + * pn_socket_t handles from ::pn_pipe() may only be used with + * ::pn_read(), ::pn_write(), ::pn_close() and pn_selector_select(). + * + * pn_socket_t handles from ::pn_listen(), ::pn_accept() and + * ::pn_connect() must perform further IO using Proton functions. + * Mixing Proton io.h functions with native IO functions on the same + * handles will result in undefined behavior. + * + * pn_socket_t handles may only be used with a single pn_io_t during + * their lifetime. + */ +#if defined(_WIN32) && ! defined(__CYGWIN__) +#ifdef _WIN64 +typedef unsigned __int64 pn_socket_t; +#else +typedef unsigned int pn_socket_t; +#endif +#define PN_INVALID_SOCKET (pn_socket_t)(~0) +#else +typedef int pn_socket_t; +#define PN_INVALID_SOCKET (-1) +#endif + +/** * A selectable object provides an interface that can be used to * incorporate proton's I/O into third party event loops. * @@ -72,7 +99,7 @@ typedef struct pn_selectable_t pn_selectable_t; * * @return a pointer to a new selectables iterator */ -PN_EXTERN pn_selectables_t *pn_selectables(void); +PNX_EXTERN pn_selectables_t *pn_selectables(void); /** * Get the next selectable from an iterator. @@ -80,25 +107,25 @@ PN_EXTERN pn_selectables_t *pn_selectables(void); * @param[in] selectables a selectable iterator * @return the next selectable from the iterator */ -PN_EXTERN pn_selectable_t *pn_selectables_next(pn_selectables_t *selectables); +PNX_EXTERN pn_selectable_t *pn_selectables_next(pn_selectables_t *selectables); /** * Free a selectables iterator. * * @param[in] selectables a selectables iterator (or NULL) */ -PN_EXTERN void pn_selectables_free(pn_selectables_t *selectables); +PNX_EXTERN void pn_selectables_free(pn_selectables_t *selectables); -PN_EXTERN pn_selectable_t *pn_selectable(void); +PNX_EXTERN pn_selectable_t *pn_selectable(void); -PN_EXTERN void pn_selectable_on_readable(pn_selectable_t *sel, void (*readable)(pn_selectable_t *)); -PN_EXTERN void pn_selectable_on_writable(pn_selectable_t *sel, void (*writable)(pn_selectable_t *)); -PN_EXTERN void pn_selectable_on_expired(pn_selectable_t *sel, void (*expired)(pn_selectable_t *)); -PN_EXTERN void pn_selectable_on_error(pn_selectable_t *sel, void (*error)(pn_selectable_t *)); -PN_EXTERN void pn_selectable_on_release(pn_selectable_t *sel, void (*release)(pn_selectable_t *)); -PN_EXTERN void pn_selectable_on_finalize(pn_selectable_t *sel, void (*finalize)(pn_selectable_t *)); +PNX_EXTERN void pn_selectable_on_readable(pn_selectable_t *sel, void (*readable)(pn_selectable_t *)); +PNX_EXTERN void pn_selectable_on_writable(pn_selectable_t *sel, void (*writable)(pn_selectable_t *)); +PNX_EXTERN void pn_selectable_on_expired(pn_selectable_t *sel, void (*expired)(pn_selectable_t *)); +PNX_EXTERN void pn_selectable_on_error(pn_selectable_t *sel, void (*error)(pn_selectable_t *)); +PNX_EXTERN void pn_selectable_on_release(pn_selectable_t *sel, void (*release)(pn_selectable_t *)); +PNX_EXTERN void pn_selectable_on_finalize(pn_selectable_t *sel, void (*finalize)(pn_selectable_t *)); -PN_EXTERN pn_record_t *pn_selectable_attachments(pn_selectable_t *sel); +PNX_EXTERN pn_record_t *pn_selectable_attachments(pn_selectable_t *sel); /** * Get the file descriptor associated with a selectable. @@ -106,7 +133,7 @@ PN_EXTERN pn_record_t *pn_selectable_attachments(pn_selectable_t *sel); * @param[in] selectable a selectable object * @return the file descriptor associated with the selectable */ -PN_EXTERN pn_socket_t pn_selectable_get_fd(pn_selectable_t *selectable); +PNX_EXTERN pn_socket_t pn_selectable_get_fd(pn_selectable_t *selectable); /** * Set the file descriptor associated with a selectable. @@ -114,7 +141,7 @@ PN_EXTERN pn_socket_t pn_selectable_get_fd(pn_selectable_t *selectable); * @param[in] selectable a selectable object * @param[in] fd the file descriptor */ -PN_EXTERN void pn_selectable_set_fd(pn_selectable_t *selectable, pn_socket_t fd); +PNX_EXTERN void pn_selectable_set_fd(pn_selectable_t *selectable, pn_socket_t fd); /** * Check if a selectable is interested in readable events. @@ -122,9 +149,9 @@ PN_EXTERN void pn_selectable_set_fd(pn_selectable_t *selectable, pn_socket_t fd) * @param[in] selectable a selectable object * @return true iff the selectable is interested in read events */ -PN_EXTERN bool pn_selectable_is_reading(pn_selectable_t *selectable); +PNX_EXTERN bool pn_selectable_is_reading(pn_selectable_t *selectable); -PN_EXTERN void pn_selectable_set_reading(pn_selectable_t *sel, bool reading); +PNX_EXTERN void pn_selectable_set_reading(pn_selectable_t *sel, bool reading); /** * Check if a selectable is interested in writable events. @@ -132,9 +159,9 @@ PN_EXTERN void pn_selectable_set_reading(pn_selectable_t *sel, bool reading); * @param[in] selectable a selectable object * @return true iff the selectable is interested in writable events */ -PN_EXTERN bool pn_selectable_is_writing(pn_selectable_t *selectable); +PNX_EXTERN bool pn_selectable_is_writing(pn_selectable_t *selectable); - PN_EXTERN void pn_selectable_set_writing(pn_selectable_t *sel, bool writing); + PNX_EXTERN void pn_selectable_set_writing(pn_selectable_t *sel, bool writing); /** * Get the next deadline for a selectable. @@ -146,37 +173,37 @@ PN_EXTERN bool pn_selectable_is_writing(pn_selectable_t *selectable); * @param[in] selectable a selectable object * @return the next deadline or zero */ -PN_EXTERN pn_timestamp_t pn_selectable_get_deadline(pn_selectable_t *selectable); +PNX_EXTERN pn_timestamp_t pn_selectable_get_deadline(pn_selectable_t *selectable); -PN_EXTERN void pn_selectable_set_deadline(pn_selectable_t *sel, pn_timestamp_t deadline); +PNX_EXTERN void pn_selectable_set_deadline(pn_selectable_t *sel, pn_timestamp_t deadline); /** * Notify a selectable that the file descriptor is readable. * * @param[in] selectable a selectable object */ -PN_EXTERN void pn_selectable_readable(pn_selectable_t *selectable); +PNX_EXTERN void pn_selectable_readable(pn_selectable_t *selectable); /** * Notify a selectable that the file descriptor is writable. * * @param[in] selectable a selectable object */ -PN_EXTERN void pn_selectable_writable(pn_selectable_t *selectable); +PNX_EXTERN void pn_selectable_writable(pn_selectable_t *selectable); /** * Notify a selectable that there is an error on the file descriptor. * * @param[in] selectable a selectable object */ -PN_EXTERN void pn_selectable_error(pn_selectable_t *selectable); +PNX_EXTERN void pn_selectable_error(pn_selectable_t *selectable); /** * Notify a selectable that its deadline has expired. * * @param[in] selectable a selectable object */ -PN_EXTERN void pn_selectable_expired(pn_selectable_t *selectable); +PNX_EXTERN void pn_selectable_expired(pn_selectable_t *selectable); /** * Check if a selectable is registered. @@ -188,7 +215,7 @@ PN_EXTERN void pn_selectable_expired(pn_selectable_t *selectable); * @param[in] selectable * @return true if the selectable is registered */ -PN_EXTERN bool pn_selectable_is_registered(pn_selectable_t *selectable); +PNX_EXTERN bool pn_selectable_is_registered(pn_selectable_t *selectable); /** * Set the registered flag for a selectable. @@ -198,7 +225,7 @@ PN_EXTERN bool pn_selectable_is_registered(pn_selectable_t *selectable); * @param[in] selectable a selectable object * @param[in] registered the registered flag */ -PN_EXTERN void pn_selectable_set_registered(pn_selectable_t *selectable, bool registered); +PNX_EXTERN void pn_selectable_set_registered(pn_selectable_t *selectable, bool registered); /** * Check if a selectable is in the terminal state. @@ -212,23 +239,23 @@ PN_EXTERN void pn_selectable_set_registered(pn_selectable_t *selectable, bool re * @param[in] selectable a selectable object * @return true if the selectable is in the terminal state, false otherwise */ -PN_EXTERN bool pn_selectable_is_terminal(pn_selectable_t *selectable); +PNX_EXTERN bool pn_selectable_is_terminal(pn_selectable_t *selectable); /** * Terminate a selectable. * * @param[in] selectable a selectable object */ -PN_EXTERN void pn_selectable_terminate(pn_selectable_t *selectable); +PNX_EXTERN void pn_selectable_terminate(pn_selectable_t *selectable); -PN_EXTERN void pn_selectable_release(pn_selectable_t *selectable); +PNX_EXTERN void pn_selectable_release(pn_selectable_t *selectable); /** * Free a selectable object. * * @param[in] selectable a selectable object (or NULL) */ -PN_EXTERN void pn_selectable_free(pn_selectable_t *selectable); +PNX_EXTERN void pn_selectable_free(pn_selectable_t *selectable); /** * Configure a selectable with a set of callbacks that emit readable, @@ -237,7 +264,7 @@ PN_EXTERN void pn_selectable_free(pn_selectable_t *selectable); * @param[in] selectable a selectable objet * @param[in] collector a collector object */ -PN_EXTERN void pn_selectable_collect(pn_selectable_t *selectable, pn_collector_t *collector); +PNX_EXTERN void pn_selectable_collect(pn_selectable_t *selectable, pn_collector_t *collector); /** * @} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a5850716/proton-c/include/proton/selector.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/selector.h b/proton-c/include/proton/selector.h deleted file mode 100644 index c942393..0000000 --- a/proton-c/include/proton/selector.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef PROTON_SELECTOR_H -#define PROTON_SELECTOR_H 1 - -/* - * - * 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. - * - */ - -#include <proton/import_export.h> -#include <proton/selectable.h> -#include <proton/type_compat.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define PN_READABLE (1) -#define PN_WRITABLE (2) -#define PN_EXPIRED (4) -#define PN_ERROR (8) - -pn_selector_t *pni_selector(void); -PN_EXTERN void pn_selector_free(pn_selector_t *selector); -PN_EXTERN void pn_selector_add(pn_selector_t *selector, pn_selectable_t *selectable); -PN_EXTERN void pn_selector_update(pn_selector_t *selector, pn_selectable_t *selectable); -PN_EXTERN void pn_selector_remove(pn_selector_t *selector, pn_selectable_t *selectable); -PN_EXTERN size_t pn_selector_size(pn_selector_t *selector); -PN_EXTERN int pn_selector_select(pn_selector_t *select, int timeout); -PN_EXTERN pn_selectable_t *pn_selector_next(pn_selector_t *select, int *events); - -#ifdef __cplusplus -} -#endif - -#endif /* selector.h */ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a5850716/proton-c/include/proton/types.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/types.h b/proton-c/include/proton/types.h index 72db6f8..176af47 100644 --- a/proton-c/include/proton/types.h +++ b/proton-c/include/proton/types.h @@ -50,10 +50,6 @@ typedef uint32_t pn_seconds_t; typedef int64_t pn_timestamp_t; -/** Return a timestamp for the time now. */ -PN_EXTERN pn_timestamp_t pn_timestamp_now(void); - - typedef uint32_t pn_char_t; typedef uint32_t pn_decimal32_t; typedef uint64_t pn_decimal64_t; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a5850716/proton-c/include/proton/url.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/url.h b/proton-c/include/proton/url.h index 80634c1..2a68bc2 100644 --- a/proton-c/include/proton/url.h +++ b/proton-c/include/proton/url.h @@ -37,7 +37,7 @@ extern "C" { typedef struct pn_url_t pn_url_t; /** Create an empty URL */ -PN_EXTERN pn_url_t *pn_url(void); +PNX_EXTERN pn_url_t *pn_url(void); /** Parse a string URL as a pn_url_t. * @@ -56,13 +56,13 @@ PN_EXTERN pn_url_t *pn_url(void); *@param[in] url A URL string. *@return The parsed pn_url_t or NULL if url is not a valid URL string. */ -PN_EXTERN pn_url_t *pn_url_parse(const char *url); +PNX_EXTERN pn_url_t *pn_url_parse(const char *url); /** Free a URL */ -PN_EXTERN void pn_url_free(pn_url_t *url); +PNX_EXTERN void pn_url_free(pn_url_t *url); /** Clear the contents of the URL. */ -PN_EXTERN void pn_url_clear(pn_url_t *url); +PNX_EXTERN void pn_url_clear(pn_url_t *url); /** * Return the string form of a URL. @@ -70,7 +70,7 @@ PN_EXTERN void pn_url_clear(pn_url_t *url); * The returned string is owned by the pn_url_t and will become invalid if it * is modified. */ -PN_EXTERN const char *pn_url_str(pn_url_t *url); +PNX_EXTERN const char *pn_url_str(pn_url_t *url); /** *@name Getters for parts of the URL. @@ -79,12 +79,12 @@ PN_EXTERN const char *pn_url_str(pn_url_t *url); * *@{ */ -PN_EXTERN const char *pn_url_get_scheme(pn_url_t *url); -PN_EXTERN const char *pn_url_get_username(pn_url_t *url); -PN_EXTERN const char *pn_url_get_password(pn_url_t *url); -PN_EXTERN const char *pn_url_get_host(pn_url_t *url); -PN_EXTERN const char *pn_url_get_port(pn_url_t *url); -PN_EXTERN const char *pn_url_get_path(pn_url_t *url); +PNX_EXTERN const char *pn_url_get_scheme(pn_url_t *url); +PNX_EXTERN const char *pn_url_get_username(pn_url_t *url); +PNX_EXTERN const char *pn_url_get_password(pn_url_t *url); +PNX_EXTERN const char *pn_url_get_host(pn_url_t *url); +PNX_EXTERN const char *pn_url_get_port(pn_url_t *url); +PNX_EXTERN const char *pn_url_get_path(pn_url_t *url); ///@} /** @@ -94,12 +94,12 @@ PN_EXTERN const char *pn_url_get_path(pn_url_t *url); * *@{ */ -PN_EXTERN void pn_url_set_scheme(pn_url_t *url, const char *scheme); -PN_EXTERN void pn_url_set_username(pn_url_t *url, const char *username); -PN_EXTERN void pn_url_set_password(pn_url_t *url, const char *password); -PN_EXTERN void pn_url_set_host(pn_url_t *url, const char *host); -PN_EXTERN void pn_url_set_port(pn_url_t *url, const char *port); -PN_EXTERN void pn_url_set_path(pn_url_t *url, const char *path); +PNX_EXTERN void pn_url_set_scheme(pn_url_t *url, const char *scheme); +PNX_EXTERN void pn_url_set_username(pn_url_t *url, const char *username); +PNX_EXTERN void pn_url_set_password(pn_url_t *url, const char *password); +PNX_EXTERN void pn_url_set_host(pn_url_t *url, const char *host); +PNX_EXTERN void pn_url_set_port(pn_url_t *url, const char *port); +PNX_EXTERN void pn_url_set_path(pn_url_t *url, const char *path); ///@} ///@} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a5850716/proton-c/src/ProtonConfig.cmake.in ---------------------------------------------------------------------- diff --git a/proton-c/src/ProtonConfig.cmake.in b/proton-c/src/ProtonConfig.cmake.in index fce1a3a..5e50d7c 100644 --- a/proton-c/src/ProtonConfig.cmake.in +++ b/proton-c/src/ProtonConfig.cmake.in @@ -27,4 +27,7 @@ set (Proton_VERSION @PN_VERSION@) set (Proton_INCLUDE_DIRS @INCLUDEDIR@) set (Proton_LIBRARIES optimized @LIBDIR@/@PROTONLIB@ debug @LIBDIR@/@PROTONLIBDEBUG@) +set (ProtonCore_INCLUDE_DIRS @INCLUDEDIR@) +set (ProtonCore_LIBRARIES optimized @LIBDIR@/@PROTONCORELIB@ debug @LIBDIR@/@PROTONCORELIBDEBUG@) + set (Proton_FOUND True) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
